LoadingCache

A cache that automatically loads values on cache miss.

Parameters

config

Configuration for cache behavior

loader

function to load a value when not found in the cache

Type Parameters

K

Key type

V

Value type

Types

Link copied to clipboard
object Companion

Factory for LoadingCache.

Functions

Link copied to clipboard
suspend fun clear()

Removes all entries from the cache.

Link copied to clipboard
suspend fun get(key: K): V

Gets a value from the cache, auto-loading it via loader on miss.

Link copied to clipboard
suspend fun put(key: K, value: V)

Puts a value into the cache.

Link copied to clipboard
suspend fun remove(key: K): V?

Removes an entry from the cache.

Link copied to clipboard

Returns a snapshot of the current cache statistics.