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

This commit is contained in:
2024-08-02 22:17:52 +06:00
parent 892fa90c37
commit 120e7228c7
4 changed files with 186 additions and 6 deletions

View File

@@ -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>()