Prior to this commit a @CachePut operation would fail if the key
expression is invalid, but guarded with an unless condition as the
former was evaluated too early. This commit makes sure that key for
a put is only evaluated if the put operation is active.
Note that this does not apply for @Cacheable as the key needs to be
computed early to determine if a matching entry exists in the cache.
See gh-22769
@ -401,13 +402,6 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
@@ -401,13 +402,6 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
// Check if we have a cached item matching the conditions
@ -422,6 +416,12 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
@@ -422,6 +416,12 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
cacheValue=unwrapReturnValue(returnValue);
}
// Collect puts from any @Cacheable miss, if no cached item is found
@ -558,7 +558,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
@@ -558,7 +558,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
@ -832,10 +832,8 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
@@ -832,10 +832,8 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
@ -235,4 +235,15 @@ public class AnnotatedClassCacheableService implements CacheableService<Object>
@@ -235,4 +235,15 @@ public class AnnotatedClassCacheableService implements CacheableService<Object>
@ -243,4 +243,15 @@ public class DefaultCacheableService implements CacheableService<Long> {
@@ -243,4 +243,15 @@ public class DefaultCacheableService implements CacheableService<Long> {