Package-level declarations

Types

Link copied to clipboard
interface ContainerKache<K : Any, C : Any>

An interface for a container cache. A container cache is a cache that stores a value for each key in a container i.e. a file. It is used to cache files that are too large to be stored in memory. Storing an object in a container cache requires serialization and deserialization logic that is handled by the user.

Link copied to clipboard
typealias EntryRemovedListener<K, V> = (evicted: Boolean, key: K, oldValue: V, newValue: V?) -> Unit

A typealias that represents a listener that is triggered when a cache entry is removed.

Link copied to clipboard
class InMemoryKache<K : Any, V : Any> : ObjectKache<K, V>

An in-memory coroutine-safe versatile cache that stores objects by keys.

Link copied to clipboard
data class KacheKeys<K>(val keys: Set<K>, val underCreationKeys: Set<K>)

A snapshot of the keys in the cache.

Link copied to clipboard

Specifies the strategy to use when the cache has reached its capacity. The most common strategy is LRU (Least Recently Used).

Link copied to clipboard
interface ObjectKache<K : Any, V : Any>

An interface that represents a cache that stores objects by keys. It is the parent interface for InMemoryKache.

Link copied to clipboard
typealias SizeCalculator<K, V> = (key: K, value: V) -> Long

A typealias that represents a function for calculating the size of a cache entry represented by the provided key and value.

Functions

Link copied to clipboard
fun <K : Any, V : Any> InMemoryKache(maxSize: Long, configuration: InMemoryKache.Configuration<K, V>.() -> Unit = {}): InMemoryKache<K, V>

Creates a new instance of InMemoryKache with a configuration that is initialized by maxSize and configuration lambda.