mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-10-19 14:20:41 +00:00
add FullKeyValuesCacheRepoTests and small rewrite of MapWriteKeyValuesRepo.set(Map<Key, List<Value>>) function
This commit is contained in:
@@ -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>()
|
||||
|
Reference in New Issue
Block a user