LruResourceCache

open class LruResourceCache : LruCache<T, Y> , MemoryCache

An LRU in memory cache for com.bumptech.glide.load.engine.Resources.

Constructors

Link copied to clipboard
open fun LruResourceCache(size: Long)
Constructor for LruResourceCache.

Functions

Link copied to clipboard
open fun clearMemory()
Clears all items in the cache.
Link copied to clipboard
open fun contains(key: T): Boolean
Returns true if there is a value for the given key in the cache.
Link copied to clipboard
open fun get(key: T): Y
Returns the item in the cache for the given key or null if no such item exists.
Link copied to clipboard
abstract fun put(key: Key, resource: Resource<out Any>): Resource<out Any>
Add bitmap to the cache with the given key.
open fun put(key: T, item: Y): Y
Adds the given item to the cache with the given key and returns any previous entry for the given key that may have already been in the cache.
Link copied to clipboard
abstract fun remove(key: Key): Resource<out Any>
Removes the value for the given key and returns it if present or null otherwise.
open fun remove(key: T): Y
Removes the item at the given key and returns the removed item if present, and null otherwise.
Link copied to clipboard
open fun setResourceRemovedListener(listener: MemoryCache.ResourceRemovedListener)
Set the listener to be called when a bitmap is removed from the cache.
Link copied to clipboard
open fun setSizeMultiplier(multiplier: Float)
Sets a size multiplier that will be applied to the size provided in the constructor to put the new size of the cache.
Link copied to clipboard
open fun trimMemory(level: Int)
Trim the memory cache to the appropriate level.

Properties

Link copied to clipboard
open val currentSize: Long
Link copied to clipboard
open val maxSize: Long