Package io.micronaut.cache.annotation
Annotation Interface Cacheable
@Target({METHOD,TYPE})
@Retention(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().
- Since:
 - 1.0
 - Author:
 - Graeme Rocher
 
- 
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanWhether an atomic operation should be attempted to retrieve the cache value.String[]Alias forCacheConfig.cacheNames().Class<? extends CacheKeyGenerator>Alias forCacheConfig.keyGenerator().String[]Limit the automaticCacheKeyGeneratorto the given parameter names.String[]Alias forCacheConfig.cacheNames(). 
- 
Element Details
- 
value
@AliasFor(member="cacheNames") @AliasFor(annotation=CacheConfig.class,member="cacheNames") String[] valueAlias forCacheConfig.cacheNames().- Returns:
 - The cache names
 
- Default:
 - {}
 
 - 
cacheNames
Alias forCacheConfig.cacheNames().- Returns:
 - The cache names
 
- Default:
 - {}
 
 - 
parameters
String[] parametersLimit the automaticCacheKeyGeneratorto the given parameter names. Mutually exclusive withkeyGenerator()- Returns:
 - The parameter names that make up the key.
 
- Default:
 - {}
 
 - 
keyGenerator
@AliasFor(annotation=CacheConfig.class, member="keyGenerator") @InstantiatedMember Class<? extends CacheKeyGenerator> keyGeneratorAlias forCacheConfig.keyGenerator().- Returns:
 - The cache key generator class
 
- Default:
 - io.micronaut.cache.interceptor.DefaultCacheKeyGenerator.class
 
 - 
atomic
boolean atomicWhether an atomic operation should be attempted to retrieve the cache value. This will call
SyncCache.get(Object, Class, java.util.function.Supplier)if set totrueotherwiseSyncCache.get(Object, Class)will be called which is non-atomicNote that atomic operations will pick the first cache name specified and ignore the remaining.
- Returns:
 - True if an atomic operation should be attempted
 
- Default:
 - false
 
 
 -