CacheRemove is invoked a GeneratedCacheKey will be generated and Cache#remove(Object) will be
invoked on the specified cache.
The default behavior is to call Cache#remove(Object) after
the annotated method is invoked, this behavior can be changed by setting
afterInvocation() to false in which case
Cache#remove(Object) will be called before the annotated
method is invoked.
Example of removing a specific Domain object from the "domainCache". A GeneratedCacheKey will be generated from the String and int parameters and
used to call Cache#remove(Object) after the deleteDomain
method completes successfully.
package my.app;
public class DomainDao {
@CacheRemove(cacheName="domainCache")
public void deleteDomain(String domainId, int index) {
...
}
}
Exception Handling, only used if afterInvocation() is true.
evictFor() and noEvictFor() are both empty then all
exceptions prevent the removeevictFor() is specified and noEvictFor() is not
specified then only exceptions that pass an instanceof check against the
evictFor list result in a removenoEvictFor() is specified and evictFor() is not
specified then all exceptions that do not pass an instanceof check against the
noEvictFor result in a removeevictFor() and noEvictFor() are both specified then
exceptions that pass an instanceof check against the evictFor list but do not
pass an instanceof check against the noEvictFor list result in a removeCacheKey
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public Class | cacheKeyGenerator()
The |
| public String | |
| public Class | |
| public Class | |
| public Class | noEvictFor()
Defines zero (0) or more exception |
| afterInvocation | back to summary |
|---|---|
| public boolean afterInvocation() When Defaults to true. If true and the annotated method throws an exception the remove will not be executed.
| |
| cacheKeyGenerator | back to summary |
|---|---|
| public Class The
Defaults to a key generator that uses
| |
| cacheName | back to summary |
|---|---|
| public String cacheName() The name of the cache.
If not specified defaults first to
| |
| cacheResolverFactory | back to summary |
|---|---|
| public Class The
The default resolver pair will resolve the cache by name from the default
| |
| evictFor | back to summary |
|---|---|
| public Class Defines zero (0) or more exception
| |
| noEvictFor | back to summary |
|---|---|
| public Class Defines zero (0) or more exception
| |