Actual caching of null values in retrieve(key, valueLoader)

See gh-31637
This commit is contained in:
Juergen Hoeller
2023-11-22 15:56:26 +01:00
parent 441e210533
commit 824bc09d11
3 changed files with 14 additions and 5 deletions

View File

@@ -181,7 +181,9 @@ class CaffeineCacheManagerTests {
assertThat(cache1.retrieve("key3", () -> CompletableFuture.completedFuture("value3")).join())
.isEqualTo("value3");
cache1.evict("key3");
assertThat(cache1.retrieve("key3")).isNull();
assertThat(cache1.retrieve("key3", () -> CompletableFuture.completedFuture(null)).join()).isNull();
assertThat(cache1.retrieve("key3").join()).isEqualTo(new SimpleValueWrapper(null));
assertThat(cache1.retrieve("key3", () -> CompletableFuture.completedFuture(null)).join()).isNull();
}