Package io.micronaut.cache.annotation
Annotation Interface CacheInvalidate
@Target({METHOD,TYPE})
@Retention(RUNTIME)
@Inherited
@Documented
@CacheConfig
@CacheAnnotation
@Repeatable(InvalidateOperations.class)
public @interface CacheInvalidate
An annotation that can be applied at the type or method level to indicate that the annotated operation should cause the eviction of the given caches.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionboolean
boolean
Whether the cache operation should be performed asynchronously and not block the returning value.String[]
Alias forCacheConfig.cacheNames()
.Evaluated expression that can be used to indicate whether the value should be cached.Class<? extends CacheKeyGenerator>
Alias forCacheConfig.keyGenerator()
.String[]
Limit the automaticCacheKeyGenerator
to the given parameter names.String[]
Alias forCacheConfig.cacheNames()
.
-
Element Details
-
value
Alias forCacheConfig.cacheNames()
.- Returns:
- Cache names
- Default:
- {}
-
cacheNames
Alias forCacheConfig.cacheNames()
.- Returns:
- Cache names
- Default:
- {}
-
keyGenerator
@AliasFor(annotation=CacheConfig.class, member="keyGenerator") Class<? extends CacheKeyGenerator> keyGeneratorAlias forCacheConfig.keyGenerator()
.- Returns:
- The key generator class
- Default:
- io.micronaut.cache.interceptor.DefaultCacheKeyGenerator.class
-
parameters
String[] parametersLimit the automaticCacheKeyGenerator
to the given parameter names. Mutually exclusive withkeyGenerator()
- Returns:
- The parameter names that make up the key.
- Default:
- {}
-
all
boolean all- Returns:
- Whether all values within the cache should be evicted or only those for the generated key
- Default:
- false
-
async
boolean asyncWhether the cache operation should be performed asynchronously and not block the returning value. Note that when set totrue
then any cache errors will not be propagated back to the client and will simply be logged by default unless the return value itself is a non-blocking type such asCompletableFuture
.- Returns:
- True if should be done asynchronously
- Default:
- false
-
condition
String conditionEvaluated expression that can be used to indicate whether the value should be cached. Will be evaluated each time the method is called, and if the condition evaluates to false the cache will not be used.- Returns:
- The condition
- Since:
- 4.2.0
- See Also:
- Default:
- ""
-