|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bumptech.glide.load.engine.cache.MemoryCacheAdapter
public class MemoryCacheAdapter
A simple class that ignores all puts and returns null for all gets.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.bumptech.glide.load.engine.cache.MemoryCache |
---|
MemoryCache.ResourceRemovedListener |
Constructor Summary | |
---|---|
MemoryCacheAdapter()
|
Method Summary | |
---|---|
void |
clearMemory()
Evict all items from the memory cache. |
int |
getCurrentSize()
Returns the sum of the sizes of all the contents of the cache in bytes. |
int |
getMaxSize()
Returns the current maximum size in bytes of the cache. |
Resource<?> |
put(Key key,
Resource<?> resource)
Add bitmap to the cache with the given key. |
Resource<?> |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MemoryCacheAdapter()
Method Detail |
---|
public int getCurrentSize()
MemoryCache
getCurrentSize
in interface MemoryCache
public int getMaxSize()
MemoryCache
getMaxSize
in interface MemoryCache
public void setSizeMultiplier(float multiplier)
MemoryCache
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.
setSizeMultiplier
in interface MemoryCache
multiplier
- A size multiplier >= 0.public Resource<?> remove(Key key)
MemoryCache
remove
in interface MemoryCache
key
- The key.public Resource<?> put(Key key, Resource<?> resource)
MemoryCache
put
in interface MemoryCache
key
- The key to retrieve the bitmap.resource
- The EngineResource
to store.
public void setResourceRemovedListener(MemoryCache.ResourceRemovedListener listener)
MemoryCache
setResourceRemovedListener
in interface MemoryCache
listener
- The listener.public void clearMemory()
MemoryCache
clearMemory
in interface MemoryCache
public void trimMemory(int level)
MemoryCache
trimMemory
in interface MemoryCache
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 |