com.nostra13.universalimageloader.cache.memory.impl
Class LimitedAgeMemoryCache

java.lang.Object
  extended by com.nostra13.universalimageloader.cache.memory.impl.LimitedAgeMemoryCache
All Implemented Interfaces:
MemoryCache, MemoryCacheAware<String,android.graphics.Bitmap>

public class LimitedAgeMemoryCache
extends Object
implements MemoryCache

Decorator for MemoryCache. Provides special feature for cache: if some cached object age exceeds defined value then this object will be removed from cache.

Since:
1.3.1
Author:
Sergey Tarasevich (nostra13[at]gmail[dot]com)
See Also:
MemoryCache

Constructor Summary
LimitedAgeMemoryCache(MemoryCache cache, long maxAge)
           
 
Method Summary
 void clear()
          Remove all items from cache
 android.graphics.Bitmap get(String key)
          Returns value by key.
 Collection<String> keys()
          Returns all keys of cache
 boolean put(String key, android.graphics.Bitmap value)
          Puts value into cache by key
 android.graphics.Bitmap remove(String key)
          Removes item by key
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LimitedAgeMemoryCache

public LimitedAgeMemoryCache(MemoryCache cache,
                             long maxAge)
Parameters:
cache - Wrapped memory cache
maxAge - Max object age (in seconds). If object age will exceed this value then it'll be removed from cache on next treatment (and therefore be reloaded).
Method Detail

put

public boolean put(String key,
                   android.graphics.Bitmap value)
Description copied from interface: MemoryCacheAware
Puts value into cache by key

Specified by:
put in interface MemoryCacheAware<String,android.graphics.Bitmap>
Returns:
true - if value was put into cache successfully, false - if value was not put into cache

get

public android.graphics.Bitmap get(String key)
Description copied from interface: MemoryCacheAware
Returns value by key. If there is no value for key then null will be returned.

Specified by:
get in interface MemoryCacheAware<String,android.graphics.Bitmap>

remove

public android.graphics.Bitmap remove(String key)
Description copied from interface: MemoryCacheAware
Removes item by key

Specified by:
remove in interface MemoryCacheAware<String,android.graphics.Bitmap>

keys

public Collection<String> keys()
Description copied from interface: MemoryCacheAware
Returns all keys of cache

Specified by:
keys in interface MemoryCacheAware<String,android.graphics.Bitmap>

clear

public void clear()
Description copied from interface: MemoryCacheAware
Remove all items from cache

Specified by:
clear in interface MemoryCacheAware<String,android.graphics.Bitmap>


Copyright © 2011-2014. All Rights Reserved.