Annotation Type CacheDefaults


  • @Target(TYPE)
    @Retention(RUNTIME)
    public @interface CacheDefaults
    Allows the configuration of defaults for CacheResult, CachePut, CacheRemove, and CacheRemoveAll at the class level. Without the method level annotations this annotation has no effect.

    Following is an example of specifying a default cache name that is used by the annotations on the getDomain and deleteDomain methods. The annotation for getAllDomains would use the "allDomains" cache name specified in the method level annotation.

    
     package my.app;
     
     @CacheDefaults(cacheName="domainCache")
     public class DomainDao {
       @CacheResult
       public Domain getDomain(String domainId, int index) {
         ...
       }
     
       @CacheRemove
       public void deleteDomain(String domainId, int index) {
         ...
       }
     
       @CacheResult(cacheName="allDomains")
       public List<Domain> getAllDomains() {
         ...
       }
     }
     
    Since:
    1.0
    Author:
    Rick Hightower