From 5180d6fc3ed028199051ebeeb14e83141cc1b388 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 10 Mar 2023 18:43:43 +0600 Subject: [PATCH] hotfixes --- .../dev/inmo/micro_utils/repos/cache/util/ActualizeAll.kt | 8 +++----- .../dev/inmo/micro_utils/repos/keyvalue/KeyValueStore.kt | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/repos/cache/src/commonMain/kotlin/dev/inmo/micro_utils/repos/cache/util/ActualizeAll.kt b/repos/cache/src/commonMain/kotlin/dev/inmo/micro_utils/repos/cache/util/ActualizeAll.kt index 61287183ff7..eb4db819b5c 100644 --- a/repos/cache/src/commonMain/kotlin/dev/inmo/micro_utils/repos/cache/util/ActualizeAll.kt +++ b/repos/cache/src/commonMain/kotlin/dev/inmo/micro_utils/repos/cache/util/ActualizeAll.kt @@ -28,7 +28,7 @@ suspend inline fun KVCache.actualizeAll( clear: Boolean = true, ) { actualizeAll(clear) { - repo.getAll { keys(it) }.toMap() + repo.getAll() } } @@ -37,7 +37,7 @@ suspend inline fun KVCache>.actualizeAll( clear: Boolean = true, ) { actualizeAll(clear) { - repo.getAll { keys(it) }.toMap() + repo.getAll() } } @@ -46,8 +46,6 @@ suspend inline fun KVCache.actualizeAll( clear: Boolean = true, ) { actualizeAll(clear) { - repo.getAllByWithNextPaging { - getIdsByPagination(it) - }.mapNotNull { it to (repo.getById(it) ?: return@mapNotNull null) }.toMap() + repo.getAll() } } diff --git a/repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/keyvalue/KeyValueStore.kt b/repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/keyvalue/KeyValueStore.kt index 92ada5a009c..6cd00e7f151 100644 --- a/repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/keyvalue/KeyValueStore.kt +++ b/repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/keyvalue/KeyValueStore.kt @@ -106,9 +106,9 @@ class KeyValueStore internal constructor ( override suspend fun getAll(): Map { val resultMap = mutableMapOf() - sharedPreferences.all.forEach { (k, v) -> + for ((k, v) in sharedPreferences.all) { @Suppress("UNCHECKED_CAST") - resultMap[k] = (v as? T) ?: return@forEach + resultMap[k] = (v as? T) ?: continue } return resultMap.toMap() }