mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-17 13:53:49 +00:00
Update AutoRecacheWriteCRUDRepo.kt
This commit is contained in:
parent
8a890ed6ed
commit
4a7567f288
@ -5,6 +5,7 @@ import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions
|
|||||||
import dev.inmo.micro_utils.repos.UpdatedValuePair
|
import dev.inmo.micro_utils.repos.UpdatedValuePair
|
||||||
import dev.inmo.micro_utils.repos.WriteCRUDRepo
|
import dev.inmo.micro_utils.repos.WriteCRUDRepo
|
||||||
import dev.inmo.micro_utils.repos.cache.cache.FullKVCache
|
import dev.inmo.micro_utils.repos.cache.cache.FullKVCache
|
||||||
|
import dev.inmo.micro_utils.repos.cache.FallbackCacheRepo
|
||||||
import dev.inmo.micro_utils.repos.set
|
import dev.inmo.micro_utils.repos.set
|
||||||
import dev.inmo.micro_utils.repos.unset
|
import dev.inmo.micro_utils.repos.unset
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
@ -18,7 +19,7 @@ open class AutoRecacheWriteCRUDRepo<RegisteredObject, Id, InputObject>(
|
|||||||
protected val scope: CoroutineScope,
|
protected val scope: CoroutineScope,
|
||||||
protected val kvCache: FullKVCache<Id, RegisteredObject> = FullKVCache(),
|
protected val kvCache: FullKVCache<Id, RegisteredObject> = FullKVCache(),
|
||||||
protected val idGetter: (RegisteredObject) -> Id
|
protected val idGetter: (RegisteredObject) -> Id
|
||||||
) : WriteCRUDRepo<RegisteredObject, Id, InputObject> {
|
) : WriteCRUDRepo<RegisteredObject, Id, InputObject>, FallbackCacheRepo {
|
||||||
override val deletedObjectsIdsFlow: Flow<Id>
|
override val deletedObjectsIdsFlow: Flow<Id>
|
||||||
get() = (originalRepo.deletedObjectsIdsFlow + kvCache.onValueRemoved).distinctUntilChanged()
|
get() = (originalRepo.deletedObjectsIdsFlow + kvCache.onValueRemoved).distinctUntilChanged()
|
||||||
override val newObjectsFlow: Flow<RegisteredObject>
|
override val newObjectsFlow: Flow<RegisteredObject>
|
||||||
|
Loading…
Reference in New Issue
Block a user