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>,
|
kvCache: KVCache<Key, Value>,
|
||||||
scope: CoroutineScope = CoroutineScope(Dispatchers.Default),
|
scope: CoroutineScope = CoroutineScope(Dispatchers.Default),
|
||||||
locker: SmartRWLocker = SmartRWLocker(),
|
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 {
|
protected val onNewJob = kvRepo.onNewValue.onEach {
|
||||||
locker.withWriteLock {
|
locker.withWriteLock {
|
||||||
kvCache.set(it.first, it.second)
|
kvCache.set(it.first, it.second)
|
||||||
|
@@ -8,21 +8,21 @@ import kotlinx.coroutines.CoroutineScope
|
|||||||
import kotlin.time.Duration.Companion.seconds
|
import kotlin.time.Duration.Companion.seconds
|
||||||
|
|
||||||
open class AutoRecacheKeyValueRepo<Id, RegisteredObject>(
|
open class AutoRecacheKeyValueRepo<Id, RegisteredObject>(
|
||||||
override val originalRepo: KeyValueRepo<Id, RegisteredObject>,
|
protected val kvRepo: KeyValueRepo<Id, RegisteredObject>,
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
kvCache: KeyValueRepo<Id, RegisteredObject> = MapKeyValueRepo(),
|
kvCache: KeyValueRepo<Id, RegisteredObject> = MapKeyValueRepo(),
|
||||||
recacheDelay: Long = 60.seconds.inWholeMilliseconds,
|
recacheDelay: Long = 60.seconds.inWholeMilliseconds,
|
||||||
actionWrapper: ActionWrapper = ActionWrapper.Direct,
|
actionWrapper: ActionWrapper = ActionWrapper.Direct,
|
||||||
idGetter: (RegisteredObject) -> Id
|
idGetter: (RegisteredObject) -> Id
|
||||||
) : AutoRecacheReadKeyValueRepo<Id, RegisteredObject> (
|
) : AutoRecacheReadKeyValueRepo<Id, RegisteredObject> (
|
||||||
originalRepo,
|
kvRepo,
|
||||||
scope,
|
scope,
|
||||||
kvCache,
|
kvCache,
|
||||||
recacheDelay,
|
recacheDelay,
|
||||||
actionWrapper,
|
actionWrapper,
|
||||||
idGetter
|
idGetter
|
||||||
),
|
),
|
||||||
WriteKeyValueRepo<Id, RegisteredObject> by AutoRecacheWriteKeyValueRepo(originalRepo, scope, kvCache),
|
WriteKeyValueRepo<Id, RegisteredObject> by AutoRecacheWriteKeyValueRepo(kvRepo, scope, kvCache),
|
||||||
KeyValueRepo<Id, RegisteredObject> {
|
KeyValueRepo<Id, RegisteredObject> {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -34,14 +34,14 @@ open class AutoRecacheKeyValueRepo<Id, RegisteredObject>(
|
|||||||
idGetter: (RegisteredObject) -> Id
|
idGetter: (RegisteredObject) -> Id
|
||||||
) : this(originalRepo, scope, kvCache, recacheDelay, ActionWrapper.Timeouted(originalCallTimeoutMillis), idGetter)
|
) : 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
|
toUnset
|
||||||
).also {
|
).also {
|
||||||
kvCache.unsetWithValues(toUnset)
|
kvCache.unsetWithValues(toUnset)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun clear() {
|
override suspend fun clear() {
|
||||||
originalRepo.clear()
|
kvRepo.clear()
|
||||||
kvCache.clear()
|
kvCache.clear()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,19 +9,19 @@ import kotlinx.coroutines.CoroutineScope
|
|||||||
import kotlin.time.Duration.Companion.seconds
|
import kotlin.time.Duration.Companion.seconds
|
||||||
|
|
||||||
open class AutoRecacheKeyValuesRepo<Id, RegisteredObject>(
|
open class AutoRecacheKeyValuesRepo<Id, RegisteredObject>(
|
||||||
override val originalRepo: KeyValuesRepo<Id, RegisteredObject>,
|
protected val kvsRepo: KeyValuesRepo<Id, RegisteredObject>,
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
kvCache: KeyValueRepo<Id, List<RegisteredObject>> = MapKeyValueRepo(),
|
kvCache: KeyValueRepo<Id, List<RegisteredObject>> = MapKeyValueRepo(),
|
||||||
recacheDelay: Long = 60.seconds.inWholeMilliseconds,
|
recacheDelay: Long = 60.seconds.inWholeMilliseconds,
|
||||||
actionWrapper: ActionWrapper = ActionWrapper.Direct
|
actionWrapper: ActionWrapper = ActionWrapper.Direct
|
||||||
) : AutoRecacheReadKeyValuesRepo<Id, RegisteredObject> (
|
) : AutoRecacheReadKeyValuesRepo<Id, RegisteredObject> (
|
||||||
originalRepo,
|
kvsRepo,
|
||||||
scope,
|
scope,
|
||||||
kvCache,
|
kvCache,
|
||||||
recacheDelay,
|
recacheDelay,
|
||||||
actionWrapper
|
actionWrapper
|
||||||
),
|
),
|
||||||
WriteKeyValuesRepo<Id, RegisteredObject> by AutoRecacheWriteKeyValuesRepo(originalRepo, scope, kvCache),
|
WriteKeyValuesRepo<Id, RegisteredObject> by AutoRecacheWriteKeyValuesRepo(kvsRepo, scope, kvCache),
|
||||||
KeyValuesRepo<Id, RegisteredObject> {
|
KeyValuesRepo<Id, RegisteredObject> {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
Reference in New Issue
Block a user