public class LRULimitedMemoryCache extends LimitedMemoryCache
bitmap
cache. Provides bitmaps
storing. Size of all stored bitmaps will not to
exceed size limit. When cache reaches limit size then the least recently used bitmap is deleted from cache.Constructor and Description |
---|
LRULimitedMemoryCache(int maxSize) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Remove all items from cache
|
protected java.lang.ref.Reference<android.graphics.Bitmap> |
createReference(android.graphics.Bitmap value)
Creates not strong reference of value
|
android.graphics.Bitmap |
get(java.lang.String key)
Returns value by key.
|
protected int |
getSize(android.graphics.Bitmap value) |
boolean |
put(java.lang.String key,
android.graphics.Bitmap value)
Puts value into cache by key
|
android.graphics.Bitmap |
remove(java.lang.String key)
Removes item by key
|
protected android.graphics.Bitmap |
removeNext() |
getSizeLimit
keys
public LRULimitedMemoryCache(int maxSize)
maxSize
- Maximum sum of the sizes of the Bitmaps in this cachepublic boolean put(java.lang.String key, android.graphics.Bitmap value)
MemoryCache
put
in interface MemoryCache
put
in class LimitedMemoryCache
public android.graphics.Bitmap get(java.lang.String key)
MemoryCache
get
in interface MemoryCache
get
in class BaseMemoryCache
public android.graphics.Bitmap remove(java.lang.String key)
MemoryCache
remove
in interface MemoryCache
remove
in class LimitedMemoryCache
public void clear()
MemoryCache
clear
in interface MemoryCache
clear
in class LimitedMemoryCache
protected int getSize(android.graphics.Bitmap value)
getSize
in class LimitedMemoryCache
protected android.graphics.Bitmap removeNext()
removeNext
in class LimitedMemoryCache
protected java.lang.ref.Reference<android.graphics.Bitmap> createReference(android.graphics.Bitmap value)
BaseMemoryCache
createReference
in class BaseMemoryCache