add FullKeyValuesCacheRepoTests and small rewrite of MapWriteKeyValuesRepo.set(Map<Key, List<Value>>) function

This commit is contained in:
InsanusMokrassar committed 2024-08-07 16:50:13 +06:00
1 parent 892fa90c37
commit 120e7228c7
4 files changed
+186 -6

No files matched your search

@@ -108,6 +108,19 @@ class MapWriteKeyValuesRepo<Key, Value>(
}
}
override suspend fun set(toSet: Map<Key, List<Value>>) {
locker.withWriteLock {
toSet.forEach {
map[it.key] = it.value.toMutableList()
}
}
toSet.forEach { (k, v) ->
v.forEach {
_onNewValue.emit(k to it)
}
}
}
override suspend fun remove(toRemove: Map<Key, List<Value>>) {
val removed = mutableListOf<Pair<Key, Value>>()
val cleared = mutableListOf<Key>()