From 90081f787f2f24e6ab73baa81c9b11510d87c799 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 30 Apr 2014 11:40:54 +0200 Subject: [PATCH] Fix Cacheable javadoc This commits fixes a confusing phrasing of Cacheable javadoc that mentioned explicitly that the method signature is used to compute the key for the cache. Issue: SPR-11736 --- .../springframework/cache/annotation/Cacheable.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/cache/annotation/Cacheable.java b/spring-context/src/main/java/org/springframework/cache/annotation/Cacheable.java index 3e871086b7..90b93eea36 100644 --- a/spring-context/src/main/java/org/springframework/cache/annotation/Cacheable.java +++ b/spring-context/src/main/java/org/springframework/cache/annotation/Cacheable.java @@ -26,8 +26,15 @@ import java.lang.annotation.Target; /** * Annotation indicating that a method (or all the methods on a class) can be cached. * - *

The method arguments and signature are used for computing the key while the - * returned instance is used as the cache value. + *

Each time a targeted method is invoked, a caching behavior will be applied, + * checking whether the method has been already executed for the given arguments. A + * sensible default simply uses the method parameters to compute the key but a SpEL + * expression can be provided ({@link #key()}) or a custom + * {@link org.springframework.cache.interceptor.KeyGenerator KeyGenerator} implementation + * can replace the default one ({@link #keyGenerator()}). + * + *

If no value is found in the cache for the computed key, the method is executed + * and the returned instance is used as the cache value. * * @author Costin Leau * @author Phillip Webb