Annotation Type JCacheXCacheEvict
-
@Target(METHOD) @Retention(RUNTIME) @Inherited public @interface JCacheXCacheEvict
Annotation that indicates a method should trigger cache eviction using JCacheX. This annotation provides declarative cache eviction for Spring Boot applications, allowing cached entries to be automatically removed when data is modified or becomes invalid. It integrates seamlessly with Spring's caching infrastructure and provides fine-grained control over which entries are evicted.Basic Usage Examples:
{ @code @Service public class UserService { @JCacheXCacheable(cacheName = "users") public User findUserById(String id) { return userRepository.findById(id); } @JCacheXCacheEvict(cacheName = "users") public User updateUser(User user) { User updated = userRepository.save(user); // Cache entry for this user will be evicted automatically return updated; }
- Since:
- 1.0.0
- See Also:
JCacheXCacheable
,JCacheXProperties
,CacheEvict
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description boolean
allEntries
Whether to evict all entries in the cache rather than just the computed key.boolean
beforeInvocation
Whether to evict before the method is invoked.String
cacheName
The name of the cache to evict from.String
condition
The SpEL expression to determine if eviction should occur.String
key
The SpEL expression to compute the cache key to evict.
-
-
-
Element Detail
-
cacheName
String cacheName
The name of the cache to evict from. If empty, defaults to the fully qualified method name.- Returns:
- the cache name
- Default:
- ""
-
-
-
key
String key
The SpEL expression to compute the cache key to evict. If empty, all method parameters are used.- Returns:
- the SpEL expression for the cache key
- Default:
- ""
-
-
-
condition
String condition
The SpEL expression to determine if eviction should occur. Empty means always evict.- Returns:
- the SpEL expression for the condition
- Default:
- ""
-
-