com.nostra13.universalimageloader.cache.memory
Class LimitedMemoryCache<K,V>
java.lang.Object
com.nostra13.universalimageloader.cache.memory.BaseMemoryCache<K,V>
com.nostra13.universalimageloader.cache.memory.LimitedMemoryCache<K,V>
- All Implemented Interfaces:
- MemoryCacheAware<K,V>
- Direct Known Subclasses:
- FIFOLimitedMemoryCache, LargestLimitedMemoryCache, LRULimitedMemoryCache, UsingFreqLimitedMemoryCache
public abstract class LimitedMemoryCache<K,V>
- extends BaseMemoryCache<K,V>
Limited cache. Provides object storing. Size of all stored bitmaps will not to exceed size limit (
getSizeLimit()
).
- Author:
- Sergey Tarasevich (nostra13[at]gmail[dot]com)
- See Also:
BaseMemoryCache
Method Summary |
void |
clear()
Remove all items from cache |
protected abstract int |
getSize(V value)
|
protected int |
getSizeLimit()
|
boolean |
put(K key,
V value)
Puts value into cache by key |
void |
remove(K key)
Removes item by key |
protected abstract V |
removeNext()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LimitedMemoryCache
public LimitedMemoryCache(int sizeLimit)
- Parameters:
sizeLimit
- Maximum size for cache (in bytes)
put
public boolean put(K key,
V value)
- Description copied from interface:
MemoryCacheAware
- Puts value into cache by key
- Specified by:
put
in interface MemoryCacheAware<K,V>
- Overrides:
put
in class BaseMemoryCache<K,V>
- Returns:
- true - if value was put into cache successfully, false - if value was not put into
cache
remove
public void remove(K key)
- Description copied from interface:
MemoryCacheAware
- Removes item by key
- Specified by:
remove
in interface MemoryCacheAware<K,V>
- Overrides:
remove
in class BaseMemoryCache<K,V>
clear
public void clear()
- Description copied from interface:
MemoryCacheAware
- Remove all items from cache
- Specified by:
clear
in interface MemoryCacheAware<K,V>
- Overrides:
clear
in class BaseMemoryCache<K,V>
getSizeLimit
protected int getSizeLimit()
getSize
protected abstract int getSize(V value)
removeNext
protected abstract V removeNext()
Copyright © 2011-2013. All Rights Reserved.