Polishing.

Delegate value loading to existing method to remove duplicate code paths.

Original Pull Request: #2785
This commit is contained in:
Christoph Strobl
2023-12-13 16:03:05 +01:00
parent a2af06d6fd
commit 1c8cc73edc

View File

@@ -293,11 +293,7 @@ public class RedisCache extends AbstractValueAdaptingCache {
@SuppressWarnings("unchecked")
public <T> CompletableFuture<T> retrieve(Object key, Supplier<CompletableFuture<T>> valueLoader) {
if (!getCacheWriter().supportsAsyncRetrieve()) {
throw new UnsupportedOperationException(CACHE_RETRIEVAL_UNSUPPORTED_OPERATION_EXCEPTION_MESSAGE);
}
return retrieveValue(key).thenCompose(wrapper -> {
return retrieve(key).thenCompose(wrapper -> {
if (wrapper != null) {
return CompletableFuture.completedFuture((T) wrapper.get());