-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Spring 5 Design Patterns
By :
Spring's cache abstraction provides a lot of storage integration. Spring provides CacheManager for each memory storage. You can just configure CacheManager with the application. Then the CacheManager is responsible for controlling and managing the Caches. Let's explore how to set up the CacheManager in an application.
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...