Auto Recache Key Values Repo
open class AutoRecacheKeyValuesRepo<Id, RegisteredObject>(originalRepo: KeyValuesRepo<Id, RegisteredObject>, scope: CoroutineScope, kvCache: KeyValueRepo<Id, List<RegisteredObject>> = MapKeyValueRepo(), recacheDelay: Long = 60.seconds.inWholeMilliseconds, actionWrapper: ActionWrapper = ActionWrapper.Direct) : AutoRecacheReadKeyValuesRepo<Id, RegisteredObject> , WriteKeyValuesRepo<Id, RegisteredObject> , KeyValuesRepo<Id, RegisteredObject> (source)
Constructors
Link copied to clipboard
constructor(originalRepo: KeyValuesRepo<Id, RegisteredObject>, scope: CoroutineScope, originalCallTimeoutMillis: Long, kvCache: KeyValueRepo<Id, List<RegisteredObject>> = MapKeyValueRepo(), recacheDelay: Long = 60.seconds.inWholeMilliseconds)
constructor(originalRepo: KeyValuesRepo<Id, RegisteredObject>, scope: CoroutineScope, kvCache: KeyValueRepo<Id, List<RegisteredObject>> = MapKeyValueRepo(), recacheDelay: Long = 60.seconds.inWholeMilliseconds, actionWrapper: ActionWrapper = ActionWrapper.Direct)
Properties
Functions
Link copied to clipboard
suspend fun <Id, Registered> KeyValuesRepo<Id, Registered>.applyDiff(diff: MapDiff<Id, List<Registered>>)
suspend fun <Id, Registered> KeyValuesRepo<Id, Registered>.applyDiff(other: Map<Id, List<Registered>>)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <Key, Value> ReadKeyValuesRepo<Key, Value>.cached(kvCache: KVCache<Key, List<Value>>, locker: SmartRWLocker = SmartRWLocker()): ReadKeyValuesCacheRepo<Key, Value>
fun <Key, Value> KeyValuesRepo<Key, Value>.cached(kvCache: KVCache<Key, List<Value>>, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), locker: SmartRWLocker = SmartRWLocker()): KeyValuesCacheRepo<Key, Value>
fun <Key, Value> ReadKeyValuesRepo<Key, Value>.cached(kvCache: KeyValueRepo<Key, List<Value>>, locker: SmartRWLocker = SmartRWLocker()): FullReadKeyValuesCacheRepo<Key, Value>
Link copied to clipboard
fun <Key, Value> WriteKeyValuesRepo<Key, Value>.caching(kvCache: KeyValueRepo<Key, List<Value>>, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), locker: SmartRWLocker = SmartRWLocker()): FullWriteKeyValuesCacheRepo<Key, Value>
Link copied to clipboard
Link copied to clipboard
suspend fun <Id, Registered> ReadKeyValuesRepo<Id, Registered>.diff(other: Map<Id, List<Registered>>): MapDiff<Id, List<Registered>>
Link copied to clipboard
fun <Key, Value> ReadKeyValuesRepo<Key, Value>.directlyCached(kvCache: KeyValueRepo<Key, List<Value>>, locker: SmartRWLocker = SmartRWLocker()): DirectFullReadKeyValuesCacheRepo<Key, Value>
fun <Key, Value> WriteKeyValuesRepo<Key, Value>.directlyCached(kvCache: KeyValueRepo<Key, List<Value>>, scope: CoroutineScope = CoroutineScope(Dispatchers.Default), locker: SmartRWLocker = SmartRWLocker()): DirectFullWriteKeyValuesCacheRepo<Key, Value>
Link copied to clipboard
fun <Key, Value> KeyValuesRepo<Key, Value>.directlyFullyCached(kvCache: KeyValueRepo<Key, List<Value>> = MapKeyValueRepo(), scope: CoroutineScope = CoroutineScope(Dispatchers.Default), skipStartInvalidate: Boolean = false, locker: SmartRWLocker = SmartRWLocker()): DirectFullKeyValuesCacheRepo<Key, Value>
Link copied to clipboard
fun <Key, Value> KeyValuesRepo<Key, Value>.fullyCached(kvCache: KeyValueRepo<Key, List<Value>> = MapKeyValueRepo(), scope: CoroutineScope = CoroutineScope(Dispatchers.Default), skipStartInvalidate: Boolean = false, locker: SmartRWLocker = SmartRWLocker()): FullKeyValuesCacheRepo<Key, Value>
Link copied to clipboard
open suspend override fun get(k: Id, pagination: Pagination, reversed: Boolean): PaginationResult<RegisteredObject>
Link copied to clipboard
Invalidates its internal data. It may lead to autoreload of data. In case when repo makes autoreload, it must do loading of data before clear
Link copied to clipboard
open suspend override fun keys(v: RegisteredObject, pagination: Pagination, reversed: Boolean): PaginationResult<Id>
Link copied to clipboard
Link copied to clipboard
Removes v without full clear of all data by Keys with v
Link copied to clipboard
inline fun <FromKey, FromValue, ToKey, ToValue> KeyValuesRepo<ToKey, ToValue>.withMapper(mapper: MapperRepo<FromKey, FromValue, ToKey, ToValue>): KeyValuesRepo<FromKey, FromValue>
inline fun <FromKey, FromValue, ToKey, ToValue> ReadKeyValuesRepo<ToKey, ToValue>.withMapper(mapper: MapperRepo<FromKey, FromValue, ToKey, ToValue>): ReadKeyValuesRepo<FromKey, FromValue>
inline fun <FromKey, FromValue, ToKey, ToValue> WriteKeyValuesRepo<ToKey, ToValue>.withMapper(mapper: MapperRepo<FromKey, FromValue, ToKey, ToValue>): 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>
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>