InMemoryKache
An in-memory coroutine-safe versatile cache that stores objects by keys.
It can be built using the following syntax:
val cache = InMemoryKache<String, String>(maxSize = 100) {
strategy = KacheStrategy.LRU
// Other configuration
}See also
Types
Configuration for InMemoryKache. It is used as a receiver of InMemoryKache builder.
Properties
Functions
Clears the cache, calling EntryRemovedListener on each removed entry with evicted set to false.
Removes all expired keys and their corresponding values from the cache.
Returns a KacheKeys object containing all keys in the cache, including under-creation keys.
Returns the value corresponding to the given key, or null if such a key is not present in the cache.
Returns the value corresponding to the given key, or defaultValue if such a key is not present in the cache.
Returns the value corresponding to the given key if it exists or is currently being created, or defaultValue otherwise.
Returns a read-only Set of keys currently under creation.
Cancels all in-progress creations.
Remove entries from the cache until the size is less than or equal to size.