From 1c8cc73edc9efdfd29d229cc5e3b1572eac3d3f3 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Wed, 13 Dec 2023 16:03:05 +0100 Subject: [PATCH] Polishing. Delegate value loading to existing method to remove duplicate code paths. Original Pull Request: #2785 --- .../org/springframework/data/redis/cache/RedisCache.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/org/springframework/data/redis/cache/RedisCache.java b/src/main/java/org/springframework/data/redis/cache/RedisCache.java index 38989f209..d8f6ccbef 100644 --- a/src/main/java/org/springframework/data/redis/cache/RedisCache.java +++ b/src/main/java/org/springframework/data/redis/cache/RedisCache.java @@ -293,11 +293,7 @@ public class RedisCache extends AbstractValueAdaptingCache { @SuppressWarnings("unchecked") public CompletableFuture retrieve(Object key, Supplier> 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());