org.springframework.cache.annotation
Annotation Type CacheEvict


@Target(value={METHOD,TYPE})
@Retention(value=RUNTIME)
@Inherited
@Documented
public @interface CacheEvict

Annotation indicating that a method (or all methods on a class) trigger(s) a cache invalidate operation.

Since:
3.1
Author:
Costin Leau

Required Element Summary
 String[] value
          Qualifier value for the specified cached operation.
 
Optional Element Summary
 boolean allEntries
          Whether or not all the entries inside the cache(s) are removed or not.
 boolean beforeInvocation
          Whether the eviction should occur after the method is successfully invoked (default) or before.
 String condition
          Spring Expression Language (SpEL) attribute used for conditioning the method caching.
 String key
          Spring Expression Language (SpEL) attribute for computing the key dynamically.
 

Element Detail

value

public abstract String[] value
Qualifier value for the specified cached operation.

May be used to determine the target cache (or caches), matching the qualifier value (or the bean name(s)) of (a) specific bean definition.

key

public abstract String key
Spring Expression Language (SpEL) attribute for computing the key dynamically.

Default is "", meaning all method parameters are considered as a key.

Default:
""

condition

public abstract String condition
Spring Expression Language (SpEL) attribute used for conditioning the method caching.

Default is "", meaning the method is always cached.

Default:
""

allEntries

public abstract boolean allEntries
Whether or not all the entries inside the cache(s) are removed or not. By default, only the value under the associated key is removed.

Note that specifying setting this parameter to true and specifying a key is not allowed.

Default:
false

beforeInvocation

public abstract boolean beforeInvocation
Whether the eviction should occur after the method is successfully invoked (default) or before. The latter causes the eviction to occur irrespective of the method outcome (whether it threw an exception or not) while the former does not.

Default:
false