StateFlowCache

open class StateFlowCache<K, V>(name: String, cacheScope: CoroutineScope, val expireDuration: Duration = 1.minutes)

Inheritors

Constructors

Link copied to clipboard
constructor(name: String, cacheScope: CoroutineScope, expireDuration: Duration = 1.minutes)

Functions

Link copied to clipboard
fun init(initialValues: Map<K, V>)
Link copied to clipboard
fun readWithCache(key: K, isContainedInCache: suspend (cacheValue: V?) -> Boolean, retrieveAndUpdateCache: suspend (cacheValue: V?) -> V?): Flow<V?>
Link copied to clipboard
fun reset()
Link copied to clipboard
suspend fun writeWithCache(key: K, updater: suspend (oldValue: V?) -> V?, isContainedInCache: suspend (cacheValue: V?) -> Boolean, retrieveAndUpdateCache: suspend (cacheValue: V?) -> V?, persist: suspend (newValue: V?) -> StateFlow<Boolean>?)

Properties

Link copied to clipboard
val cache: SharedFlow<Map<K, StateFlow<V?>>>
Link copied to clipboard