|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface MemoryCache
An interface for adding and removing resources from an in memory cache.
Nested Class Summary | |
---|---|
static interface |
MemoryCache.ResourceRemovedListener
An interface that will be called whenever a bitmap is removed from the cache. |
Method Summary | |
---|---|
void |
clearMemory()
Evict all items from the memory cache. |
EngineResource<?> |
put(Key key,
EngineResource<?> resource)
Add bitmap to the cache with the given key. |
EngineResource<?> |
remove(Key key)
Removes the value for the given key and returns it if present or null otherwise. |
void |
setResourceRemovedListener(MemoryCache.ResourceRemovedListener listener)
Set the listener to be called when a bitmap is removed from the cache. |
void |
setSizeMultiplier(float multiplier)
Adjust the maximum size of the cache by multiplying the original size of the cache by the given multiplier. |
void |
trimMemory(int level)
Trim the memory cache to the appropriate level. |
Method Detail |
---|
void setSizeMultiplier(float multiplier)
If the size multiplier causes the size of the cache to be decreased, items will be evicted until the cache is smaller than the new size.
multiplier
- A size multiplier >= 0.EngineResource<?> remove(Key key)
key
- The key.EngineResource<?> put(Key key, EngineResource<?> resource)
key
- The key to retrieve the bitmap.resource
- The EngineResource
to store.
void setResourceRemovedListener(MemoryCache.ResourceRemovedListener listener)
listener
- The listener.void clearMemory()
void trimMemory(int level)
level
- This integer represents a trim level as specified in ComponentCallbacks2
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |