RealSafeCache

internal class RealSafeCache<K : Any, V>(val tags: Iterable<Any>, initialValues: List<Pair<K, V>>) : SafeCache<K, V>

Constructors

Link copied to clipboard
fun <K : Any, V> RealSafeCache(tags: Iterable<Any>, initialValues: List<Pair<K, V>>)

Functions

Link copied to clipboard
open suspend override fun getOrPut(key: K, loader: suspend () -> V): V

This is conceptually similar to ConcurrentHashMap.computeIfAbsent.

Properties

Link copied to clipboard
private val delegate: Cache<K, LazyDeferred<V>>

Note that the api surface is that of a Cache<K, V>, but this is using a LazyDeferred<V>. This allows all "loader" operations to be light-weight and non-recursive.

Link copied to clipboard
open override val tags: Iterable<Any>
Link copied to clipboard
open override val values: Flow<V>

Sources

Link copied to clipboard