mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-07 00:59:26 +00:00
fix build
This commit is contained in:
@@ -62,7 +62,7 @@ open class KeyValueCacheRepo<Key,Value>(
|
||||
kvCache: KVCache<Key, Value>,
|
||||
scope: CoroutineScope = CoroutineScope(Dispatchers.Default),
|
||||
locker: SmartRWLocker = SmartRWLocker(),
|
||||
) : ReadKeyValueCacheRepo<Key,Value>(kvRepo, kvCache, locker), KeyValueRepo<Key,Value>, WriteKeyValueRepo<Key, Value> by parentRepo, CommonCacheRepo {
|
||||
) : ReadKeyValueCacheRepo<Key,Value>(kvRepo, kvCache, locker), KeyValueRepo<Key,Value>, WriteKeyValueRepo<Key, Value> by kvRepo, CommonCacheRepo {
|
||||
protected val onNewJob = kvRepo.onNewValue.onEach {
|
||||
locker.withWriteLock {
|
||||
kvCache.set(it.first, it.second)
|
||||
|
@@ -8,21 +8,21 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
open class AutoRecacheKeyValueRepo<Id, RegisteredObject>(
|
||||
override val originalRepo: KeyValueRepo<Id, RegisteredObject>,
|
||||
protected val kvRepo: KeyValueRepo<Id, RegisteredObject>,
|
||||
scope: CoroutineScope,
|
||||
kvCache: KeyValueRepo<Id, RegisteredObject> = MapKeyValueRepo(),
|
||||
recacheDelay: Long = 60.seconds.inWholeMilliseconds,
|
||||
actionWrapper: ActionWrapper = ActionWrapper.Direct,
|
||||
idGetter: (RegisteredObject) -> Id
|
||||
) : AutoRecacheReadKeyValueRepo<Id, RegisteredObject> (
|
||||
originalRepo,
|
||||
kvRepo,
|
||||
scope,
|
||||
kvCache,
|
||||
recacheDelay,
|
||||
actionWrapper,
|
||||
idGetter
|
||||
),
|
||||
WriteKeyValueRepo<Id, RegisteredObject> by AutoRecacheWriteKeyValueRepo(originalRepo, scope, kvCache),
|
||||
WriteKeyValueRepo<Id, RegisteredObject> by AutoRecacheWriteKeyValueRepo(kvRepo, scope, kvCache),
|
||||
KeyValueRepo<Id, RegisteredObject> {
|
||||
|
||||
constructor(
|
||||
@@ -34,14 +34,14 @@ open class AutoRecacheKeyValueRepo<Id, RegisteredObject>(
|
||||
idGetter: (RegisteredObject) -> Id
|
||||
) : this(originalRepo, scope, kvCache, recacheDelay, ActionWrapper.Timeouted(originalCallTimeoutMillis), idGetter)
|
||||
|
||||
override suspend fun unsetWithValues(toUnset: List<RegisteredObject>) = originalRepo.unsetWithValues(
|
||||
override suspend fun unsetWithValues(toUnset: List<RegisteredObject>) = kvRepo.unsetWithValues(
|
||||
toUnset
|
||||
).also {
|
||||
kvCache.unsetWithValues(toUnset)
|
||||
}
|
||||
|
||||
override suspend fun clear() {
|
||||
originalRepo.clear()
|
||||
kvRepo.clear()
|
||||
kvCache.clear()
|
||||
}
|
||||
}
|
||||
|
@@ -9,19 +9,19 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
open class AutoRecacheKeyValuesRepo<Id, RegisteredObject>(
|
||||
override val originalRepo: KeyValuesRepo<Id, RegisteredObject>,
|
||||
protected val kvsRepo: KeyValuesRepo<Id, RegisteredObject>,
|
||||
scope: CoroutineScope,
|
||||
kvCache: KeyValueRepo<Id, List<RegisteredObject>> = MapKeyValueRepo(),
|
||||
recacheDelay: Long = 60.seconds.inWholeMilliseconds,
|
||||
actionWrapper: ActionWrapper = ActionWrapper.Direct
|
||||
) : AutoRecacheReadKeyValuesRepo<Id, RegisteredObject> (
|
||||
originalRepo,
|
||||
kvsRepo,
|
||||
scope,
|
||||
kvCache,
|
||||
recacheDelay,
|
||||
actionWrapper
|
||||
),
|
||||
WriteKeyValuesRepo<Id, RegisteredObject> by AutoRecacheWriteKeyValuesRepo(originalRepo, scope, kvCache),
|
||||
WriteKeyValuesRepo<Id, RegisteredObject> by AutoRecacheWriteKeyValuesRepo(kvsRepo, scope, kvCache),
|
||||
KeyValuesRepo<Id, RegisteredObject> {
|
||||
|
||||
constructor(
|
||||
|
Reference in New Issue
Block a user