fixes in AutoRecacheReadKeyValueRepo

This commit is contained in:
InsanusMokrassar 2023-03-10 19:37:20 +06:00
parent 5180d6fc3e
commit 022297ad3f
1 changed files with 7 additions and 1 deletions

View File

@ -52,7 +52,13 @@ open class AutoRecacheReadKeyValueRepo<Id, RegisteredObject>(
kvCache.contains(key)
}
override suspend fun getAll(): Map<Id, RegisteredObject> = kvCache.getAll()
override suspend fun getAll(): Map<Id, RegisteredObject> = actionWrapper.wrap {
originalRepo.getAll()
}.onSuccess {
kvCache.actualizeAll(clear = true) { it }
}.getOrElse {
kvCache.getAll()
}
override suspend fun count(): Long = actionWrapper.wrap {
originalRepo.count()