Class LruResourceCache
java.lang.Object
com.bumptech.glide.util.LruCache<Key,Resource<?>>
com.bumptech.glide.load.engine.cache.LruResourceCache
- All Implemented Interfaces:
MemoryCache
An LRU in memory cache for
Resources.-
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 TypeMethodDescriptionprotected intReturns the size of a given item, defaulting to one.protected voidonItemEvicted(Key key, Resource<?> item) A callback called whenever an item is evicted from the cache.voidSet the listener to be called when a bitmap is removed from the cache.voidtrimMemory(int level) Trim the memory cache to the appropriate level.Methods inherited from class com.bumptech.glide.util.LruCache
clearMemory, contains, get, getCount, getCurrentSize, getMaxSize, put, remove, setSizeMultiplier, trimToSizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.bumptech.glide.load.engine.cache.MemoryCache
clearMemory, getCurrentSize, getMaxSize, put, remove, setSizeMultiplier
-
Constructor Details
-
LruResourceCache
public LruResourceCache(long size) Constructor for LruResourceCache.- Parameters:
size- The maximum size in bytes the in memory cache can use.
-
-
Method Details
-
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.
-
onItemEvicted
Description copied from class:LruCacheA callback called whenever an item is evicted from the cache. Subclasses can override.- Overrides:
onItemEvictedin classLruCache<Key,Resource<?>> - Parameters:
key- The key of the evicted item.item- The evicted item.
-
getSize
Description copied from class:LruCacheReturns the size of a given item, defaulting to one. The units must match those used in the size passed in to the constructor. Subclasses can override this method to return sizes in various units, usually bytes. -
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.
-