Skip to content

Commit 3bbd6c5

Browse files
committed
Add return values for refresh/refreshAll
1 parent 35f9ffb commit 3bbd6c5

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

aedile-core/src/main/kotlin/com/sksamuel/aedile/core/LoadingCache.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ class LoadingCache<K, V>(
181181
*
182182
* See full docs at [com.github.benmanes.caffeine.cache.LoadingCache.refresh].
183183
*/
184-
suspend fun refresh(key: K) {
185-
cache.synchronous().refresh(key).await()
184+
suspend fun refresh(key: K): V {
185+
return cache.synchronous().refresh(key).await()
186186
}
187187

188188
/**
@@ -191,8 +191,8 @@ class LoadingCache<K, V>(
191191
*
192192
* See full docs at [com.github.benmanes.caffeine.cache.LoadingCache.refreshAll].
193193
*/
194-
suspend fun refreshAll(keys: Collection<K>) {
195-
cache.synchronous().refreshAll(keys).await()
194+
suspend fun refreshAll(keys: Collection<K>): Map<K?, V?> {
195+
return cache.synchronous().refreshAll(keys).await()
196196
}
197197

198198
private suspend fun scope(): CoroutineScope {

aedile-core/src/test/kotlin/com/sksamuel/aedile/core/AsLoadingCacheTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class AsLoadingCacheTest : FunSpec() {
328328
counter
329329
}
330330
cache.get("foo") shouldBe 1
331-
cache.refresh("foo")
331+
cache.refresh("foo") shouldBe 2
332332
eventually(5.seconds) {
333333
cache.get("foo") shouldBe 2
334334
}
@@ -342,7 +342,7 @@ class AsLoadingCacheTest : FunSpec() {
342342
}
343343
cache.get("foo") shouldBe 1
344344
cache.get("bar") shouldBe 2
345-
cache.refreshAll(setOf("foo", "bar"))
345+
cache.refreshAll(setOf("foo", "bar")) shouldBe mapOf("foo" to 3, "bar" to 4)
346346
eventually(5.seconds) {
347347
cache.get("foo") shouldBe 3
348348
cache.get("bar") shouldBe 4

buildSrc/src/main/kotlin/Ci.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ object Ci {
22

33
// this is the version used for building snapshots
44
// .GITHUB_RUN_NUMBER-snapshot will be appended
5-
private const val snapshotBase = "2.2.0"
5+
private const val SNAPSHOT_BASE = "2.2.0"
66

77
private val githubRunNumber = System.getenv("GITHUB_RUN_NUMBER")
88

99
private val snapshotVersion = when (githubRunNumber) {
10-
null -> "$snapshotBase-LOCAL"
11-
else -> "$snapshotBase.${githubRunNumber}-SNAPSHOT"
10+
null -> "$SNAPSHOT_BASE-LOCAL"
11+
else -> "$SNAPSHOT_BASE.${githubRunNumber}-SNAPSHOT"
1212
}
1313

1414
private val releaseVersion = System.getenv("RELEASE_VERSION")

0 commit comments

Comments
 (0)