Setting up the CacheManager

You must specify a cache manager in the application for storage, and some cache provider given to the CacheManager, or you can write your own CacheManager. Spring provides several cache managers in the org.springframework.cache package, for example, ConcurrentMapCacheManager, which creates a ConcurrentHashMap for each cache storage unit.

    @Bean 
    public CacheManager cacheManager() { 
      CacheManager cacheManager = new ConcurrentMapCacheManager(); 
      return cacheManager; 
    }

SimpleCacheManager, ConcurrentMapCacheManager, and others are cache managers of the Spring Framework's cache abstraction. But Spring provides support for integration with third-party cache managers, as we will see in the following section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset