Guest User

Untitled

a guest
Oct 20th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. import org.springframework.cache.CacheManager;
  2. import org.springframework.cache.annotation.EnableCaching;
  3. import org.springframework.cache.concurrent.ConcurrentMapCache;
  4. import org.springframework.cache.support.SimpleCacheManager;
  5. import org.springframework.context.annotation.Bean;
  6. import org.springframework.context.annotation.ComponentScan;
  7. import org.springframework.context.annotation.Configuration;
  8.  
  9. @Configuration
  10. @EnableCaching
  11. public class CachingConfiguration {
  12.  
  13. @Bean
  14. public CacheManager createCacheManager() {
  15. //We return a simple concurrent hashMap to be used as a cache
  16. //Spring supports more sophisticated cache managers such as encache, redis, mongodb, etc.
  17.  
  18. //We return a dynamic ConcurrentMapCacheManager, lazily creating cache instances as they are being requested.
  19. return new ConcurrentMapCacheManager();
  20. }
  21. }
Add Comment
Please, Sign In to add comment