MemoryCache

interface MemoryCache

An interface for adding and removing resources from an in memory cache.

Types

Link copied to clipboard
interface ResourceRemovedListener
An interface that will be called whenever a bitmap is removed from the cache.

Functions

Link copied to clipboard
abstract fun clearMemory()
Evict all items from the memory cache.
Link copied to clipboard
abstract fun getCurrentSize(): Long
Returns the sum of the sizes of all the contents of the cache in bytes.
Link copied to clipboard
abstract fun getMaxSize(): Long
Returns the current maximum size in bytes of the cache.
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.
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.
Link copied to clipboard
abstract fun setResourceRemovedListener(listener: MemoryCache.ResourceRemovedListener)
Set the listener to be called when a bitmap is removed from the cache.
Link copied to clipboard
abstract fun setSizeMultiplier(multiplier: Float)
Adjust the maximum size of the cache by multiplying the original size of the cache by the given multiplier.
Link copied to clipboard
abstract fun trimMemory(level: Int)
Trim the memory cache to the appropriate level.

Inheritors

Link copied to clipboard
Link copied to clipboard