FullRepositoryCoroutineCache

class FullRepositoryCoroutineCache<K, V>(repository: FullRepository<K, V>, tm: TransactionManager, cacheScope: CoroutineScope, expireDuration: Duration = 1.minutes, valueToKeyMapper: (V) -> K) : CoroutineCache<K, V, FullRepositoryCoroutineCacheStore<K, V>>

Constructors

Link copied to clipboard
constructor(repository: FullRepository<K, V>, tm: TransactionManager, cacheScope: CoroutineScope, expireDuration: Duration = 1.minutes, valueToKeyMapper: (V) -> K)

Properties

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

Functions

Link copied to clipboard
Link copied to clipboard
suspend fun clear()
Link copied to clipboard
suspend fun deleteAll()
Link copied to clipboard

Fill the cache with all values stored in the repository.

Link copied to clipboard
fun read(key: K): Flow<V?>
Link copied to clipboard
suspend fun write(key: K, value: V?, persistEnabled: Boolean = true, onPersist: (newValue: V?) -> Unit = {})
suspend fun write(key: K, persistEnabled: Boolean = true, onPersist: (newValue: V?) -> Unit = {}, updater: suspend (oldValue: V?) -> V?)