AutoRecacheKeyValuesRepo

open class AutoRecacheKeyValuesRepo<Id, RegisteredObject>(originalRepo: KeyValuesRepo<Id, RegisteredObject>, scope: CoroutineScope, kvCache: FullKVCache<Id, List<RegisteredObject>> = FullKVCache(), recacheDelay: Long = 60.seconds.inWholeMilliseconds, actionWrapper: ActionWrapper = ActionWrapper.Direct) : AutoRecacheReadKeyValuesRepo<Id, RegisteredObject> , WriteKeyValuesRepo<Id, RegisteredObject> , KeyValuesRepo<Id, RegisteredObject>

Constructors

Link copied to clipboard
fun <Id, RegisteredObject> AutoRecacheKeyValuesRepo(originalRepo: KeyValuesRepo<Id, RegisteredObject>, scope: CoroutineScope, originalCallTimeoutMillis: Long, kvCache: FullKVCache<Id, List<RegisteredObject>> = FullKVCache(), recacheDelay: Long = 60.seconds.inWholeMilliseconds)
Link copied to clipboard
fun <Id, RegisteredObject> AutoRecacheKeyValuesRepo(originalRepo: KeyValuesRepo<Id, RegisteredObject>, scope: CoroutineScope, kvCache: FullKVCache<Id, List<RegisteredObject>> = FullKVCache(), recacheDelay: Long = 60.seconds.inWholeMilliseconds, actionWrapper: ActionWrapper = ActionWrapper.Direct)

Functions

Link copied to clipboard
open suspend override fun add(toAdd: Map<Id, List<RegisteredObject>>)
Link copied to clipboard
open suspend override fun clear(k: Id)
Link copied to clipboard
open suspend override fun clearWithValue(v: RegisteredObject)
Link copied to clipboard
open suspend override fun contains(k: Id): Boolean
open suspend override fun contains(k: Id, v: RegisteredObject): Boolean
Link copied to clipboard
open suspend override fun count(): Long
open suspend override fun count(k: Id): Long
Link copied to clipboard
open suspend override fun get(k: Id, pagination: Pagination, reversed: Boolean): PaginationResult<RegisteredObject>
Link copied to clipboard
open suspend fun getAll(reverseLists: Boolean = false): Map<Id, List<RegisteredObject>>

WARNING!!! THIS METHOD PROBABLY IS NOT EFFICIENT, USE WITH CAUTION

open suspend fun getAll(k: Id, reversed: Boolean = false): List<RegisteredObject>
Link copied to clipboard
open suspend override fun invalidate()
Link copied to clipboard
open suspend override fun keys(pagination: Pagination, reversed: Boolean): PaginationResult<Id>
open suspend override fun keys(v: RegisteredObject, pagination: Pagination, reversed: Boolean): PaginationResult<Id>
Link copied to clipboard
open suspend override fun remove(toRemove: Map<Id, List<RegisteredObject>>)
Link copied to clipboard
open suspend override fun set(toSet: Map<Id, List<RegisteredObject>>)

Properties

Link copied to clipboard
val autoUpdateJob: Job
Link copied to clipboard
open override val onDataCleared: Flow<Id>
Link copied to clipboard
open override val onNewValue: Flow<Pair<Id, RegisteredObject>>
Link copied to clipboard
open override val onValueRemoved: Flow<Pair<Id, RegisteredObject>>

Extensions

Link copied to clipboard
inline suspend fun <Key, Value> WriteKeyValuesRepo<Key, Value>.add(k: Key, v: List<Value>)
inline suspend fun <Key, Value> WriteKeyValuesRepo<Key, Value>.add(k: Key, vararg v: Value)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <Key, Value> WriteKeyValuesRepo<Key, Value>.caching(kvCache: FullKVCache<Key, List<Value>>, scope: CoroutineScope = CoroutineScope(Dispatchers.Default)): FullWriteKeyValuesCacheRepo<Key, Value>
fun <Key, Value> KeyValuesRepo<Key, Value>.caching(kvCache: FullKVCache<Key, List<Value>>, scope: CoroutineScope = CoroutineScope(Dispatchers.Default)): FullKeyValuesCacheRepo<Key, Value>
Link copied to clipboard
inline suspend fun <Key, Value> WriteKeyValuesRepo<Key, Value>.remove(keysAndValues: List<Pair<Key, List<Value>>>)
inline suspend fun <Key, Value> WriteKeyValuesRepo<Key, Value>.remove(vararg keysAndValues: Pair<Key, List<Value>>)
inline suspend fun <Key, Value> WriteKeyValuesRepo<Key, Value>.remove(k: Key, v: List<Value>)
inline suspend fun <Key, Value> WriteKeyValuesRepo<Key, Value>.remove(k: Key, vararg v: Value)
Link copied to clipboard
inline suspend fun <Key, Value> WriteKeyValuesRepo<Key, Value>.set(k: Key, v: List<Value>)
inline suspend fun <Key, Value> WriteKeyValuesRepo<Key, Value>.set(k: Key, vararg v: Value)
Link copied to clipboard
inline fun <FromKey, FromValue, ToKey, ToValue> ReadKeyValuesRepo<ToKey, ToValue>.withMapper(noinline keyFromToTo: suspend FromKey.() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue.() -> ToValue = { this as ToValue }, noinline keyToToFrom: suspend ToKey.() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue.() -> FromValue = { this as FromValue }): ReadKeyValuesRepo<FromKey, FromValue>
inline fun <FromKey, FromValue, ToKey, ToValue> WriteKeyValuesRepo<ToKey, ToValue>.withMapper(noinline keyFromToTo: suspend FromKey.() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue.() -> ToValue = { this as ToValue }, noinline keyToToFrom: suspend ToKey.() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue.() -> FromValue = { this as FromValue }): WriteKeyValuesRepo<FromKey, FromValue>
inline fun <FromKey, FromValue, ToKey, ToValue> KeyValuesRepo<ToKey, ToValue>.withMapper(noinline keyFromToTo: suspend FromKey.() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue.() -> ToValue = { this as ToValue }, noinline keyToToFrom: suspend ToKey.() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue.() -> FromValue = { this as FromValue }): KeyValuesRepo<FromKey, FromValue>