@Target(value={METHOD,TYPE}) @Retention(value=RUNTIME) @Inherited @Documented @CacheConfig @CacheAnnotation public @interface Cacheable
An annotation that can be applied at the type or method level to indicate that the return value of the method
should be cached for
the configured cacheNames()
.
Modifier and Type | Optional Element and Description |
---|---|
boolean |
atomic
Whether an atomic operation should be attempted to retrieve the cache value.
|
String[] |
cacheNames
Alias for
CacheConfig.cacheNames() . |
Class<? extends CacheKeyGenerator> |
keyGenerator
Alias for
CacheConfig.keyGenerator() . |
String[] |
parameters
Limit the automatic
CacheKeyGenerator to the given parameter names. |
String[] |
value
Alias for
CacheConfig.cacheNames() . |
@AliasFor(member="cacheNames") @AliasFor(annotation=CacheConfig.class,member="cacheNames") public abstract String[] value
CacheConfig.cacheNames()
.@AliasFor(annotation=CacheConfig.class, member="cacheNames") public abstract String[] cacheNames
CacheConfig.cacheNames()
.public abstract String[] parameters
CacheKeyGenerator
to the given parameter names. Mutually exclusive with
keyGenerator()
@AliasFor(annotation=CacheConfig.class, member="keyGenerator") @InstantiatedMember public abstract Class<? extends CacheKeyGenerator> keyGenerator
CacheConfig.keyGenerator()
.public abstract boolean atomic
Whether an atomic operation should be attempted to retrieve the cache value. This will call
SyncCache.get(Object, Class, java.util.function.Supplier)
if set to true
otherwise
SyncCache.get(Object, Class)
will be called which is non-atomic
Note that atomic operations will pick the first cache name specified and ignore the remaining.