org.springframework.cache.annotation
Interface CachingConfigurer


public interface CachingConfigurer

Interface to be implemented by @Configuration classes annotated with @EnableCaching that wish or need to specify explicitly the CacheManager and KeyGenerator beans to be used for annotation-driven cache management.

See @EnableCaching for general examples and context; see cacheManager() and keyGenerator() for detailed instructions.

Since:
3.1
Author:
Chris Beams
See Also:
EnableCaching

Method Summary
 CacheManager cacheManager()
          Return the cache manager bean to use for annotation-driven cache management.
 KeyGenerator keyGenerator()
          Return the key generator bean to use for annotation-driven cache management.
 

Method Detail

cacheManager

CacheManager cacheManager()
Return the cache manager bean to use for annotation-driven cache management. Implementations must explicitly declare @Bean, e.g.
 @Configuration
 @EnableCaching
 public class AppConfig implements CachingConfigurer {
     @Bean // important!
     @Override
     public CacheManager cacheManager() {
         // configure and return CacheManager instance
     }
     // ...
 }
 
See @EnableCaching for more complete examples.


keyGenerator

KeyGenerator keyGenerator()
Return the key generator bean to use for annotation-driven cache management. Implementations must explicitly declare @Bean, e.g.
 @Configuration
 @EnableCaching
 public class AppConfig implements CachingConfigurer {
     @Bean // important!
     @Override
     public KeyGenerator keyGenerator() {
         // configure and return KeyGenerator instance
     }
     // ...
 }
 
See @EnableCaching for more complete examples.