CacheStore

Caches data.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard

Identifies a key namespace. These namespaces help prevent interscope key collisions.

Functions

Link copied to clipboard
fun <T : Any> getOrNull(keyNamespace: CacheStore.KeyNamespace, vararg keyComponents: Any?): T?

Retrieves the value associated with the key belonging to the specified namespace and matching the given components. If there’s no such value, null is returned.

Link copied to clipboard
fun <T : Any> getOrSet(keyNamespace: CacheStore.KeyNamespace, vararg keyComponents: Any?, value: () -> T): T

Retrieves the value associated with the key belonging to the specified namespace and matching the given components. If there’s no such value, value is called, and its result is cached and returned.

Link copied to clipboard
fun purge()

Removes all values that were added before the last call to this function and haven’t been read since the last call. When called for the first time on a given CacheStore, this function doesn’t remove any values.

Link copied to clipboard
operator fun set(keyNamespace: CacheStore.KeyNamespace, vararg keyComponents: Any?, value: Any)

Caches value.