CacheStore

class CacheStore @RestrictTo(value = [RestrictTo.Scope.LIBRARY_GROUP]) constructor

Caches data.

Constructors

Link copied to clipboard

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
operator fun set(keyNamespace: CacheStore.KeyNamespace, vararg keyComponents: Any?, value: Any)

Caches value.