@Target(value={METHOD,TYPE}) @Retention(value=RUNTIME) @Inherited @Documented @CacheConfig @Type(value=CacheInterceptor.class) 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.
|
java.lang.String[] |
cacheNames
Alias for
CacheConfig.cacheNames() . |
java.lang.Class<? extends CacheKeyGenerator> |
keyGenerator
Alias for
CacheConfig.keyGenerator() . |
java.lang.String[] |
parameters
Limit the automatic
CacheKeyGenerator to the given parameter names. |
java.lang.String[] |
value
Alias for
CacheConfig.cacheNames() . |
@AliasFor(member="cacheNames") @AliasFor(annotation=CacheConfig.class,member="cacheNames") public abstract java.lang.String[] value
CacheConfig.cacheNames()
.@AliasFor(annotation=CacheConfig.class, member="cacheNames") public abstract java.lang.String[] cacheNames
CacheConfig.cacheNames()
.public abstract java.lang.String[] parameters
CacheKeyGenerator
to the given parameter names. Mutually exclusive with
keyGenerator()
@AliasFor(annotation=CacheConfig.class, member="keyGenerator") @InstantiatedMember public abstract java.lang.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, 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.