Map Write Key Values Repo
class MapWriteKeyValuesRepo<Key, Value>(map: MutableMap<Key, MutableList<Value>> = mutableMapOf(), locker: SmartRWLocker = SmartRWLocker()) : WriteKeyValuesRepo<Key, Value> (source)
MutableMap-based WriteKeyValuesRepo. All internal operations will be locked with locker (mostly with SmartRWLocker.withWriteLock)
Warning: It is not recommended to use constructor with both MutableMap and SmartRWLocker. Besides, in case you are using your own MutableMap as a map you should be careful with operations on this map
Constructors
Link copied to clipboard
constructor(map: MutableMap<Key, MutableList<Value>> = mutableMapOf(), locker: SmartRWLocker = SmartRWLocker())
Functions
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
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
Link copied to clipboard
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> 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>