Class MemoryCacheAdapter
java.lang.Object
com.bumptech.glide.load.engine.cache.MemoryCacheAdapter
- All Implemented Interfaces:
MemoryCache
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidEvict all items from the memory cache.longReturns the sum of the sizes of all the contents of the cache in bytes.longReturns the current maximum size in bytes of the cache.Resource<?>Add bitmap to the cache with the given key.Resource<?>Removes the value for the given key and returns it if present or null otherwise.voidSet the listener to be called when a bitmap is removed from the cache.voidsetSizeMultiplier(float multiplier) Adjust the maximum size of the cache by multiplying the original size of the cache by the given multiplier.voidtrimMemory(int level) Trim the memory cache to the appropriate level.
-
Constructor Details
-
MemoryCacheAdapter
public MemoryCacheAdapter()
-
-
Method Details
-
getCurrentSize
public long getCurrentSize()Description copied from interface:MemoryCacheReturns the sum of the sizes of all the contents of the cache in bytes.- Specified by:
getCurrentSizein interfaceMemoryCache
-
getMaxSize
public long getMaxSize()Description copied from interface:MemoryCacheReturns the current maximum size in bytes of the cache.- Specified by:
getMaxSizein interfaceMemoryCache
-
setSizeMultiplier
public void setSizeMultiplier(float multiplier) Description copied from interface:MemoryCacheAdjust the maximum size of the cache by multiplying the original size of the cache by the given 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.
- Specified by:
setSizeMultiplierin interfaceMemoryCache- Parameters:
multiplier- A size multiplier>= 0.
-
remove
Description copied from interface:MemoryCacheRemoves the value for the given key and returns it if present or null otherwise.- Specified by:
removein interfaceMemoryCache- Parameters:
key- The key.
-
put
Description copied from interface:MemoryCacheAdd bitmap to the cache with the given key.- Specified by:
putin interfaceMemoryCache- Parameters:
key- The key to retrieve the bitmap.resource- Thecom.bumptech.glide.load.engine.EngineResource<Z>to store.- Returns:
- The old value of key (null if key is not in map).
-
setResourceRemovedListener
Description copied from interface:MemoryCacheSet the listener to be called when a bitmap is removed from the cache.- Specified by:
setResourceRemovedListenerin interfaceMemoryCache- Parameters:
listener- The listener.
-
clearMemory
public void clearMemory()Description copied from interface:MemoryCacheEvict all items from the memory cache.- Specified by:
clearMemoryin interfaceMemoryCache
-
trimMemory
public void trimMemory(int level) Description copied from interface:MemoryCacheTrim the memory cache to the appropriate level. Typically called on the callback onTrimMemory.- Specified by:
trimMemoryin interfaceMemoryCache- Parameters:
level- This integer represents a trim level as specified inComponentCallbacks2.
-