org.springframework.cache.support.CompositeCacheManager Java Examples

The following examples show how to use org.springframework.cache.support.CompositeCacheManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CachingConfig3.java    From Project with Apache License 2.0 5 votes vote down vote up
@Bean
public CacheManager cacheManager(net.sf.ehcache.CacheManager cm, 
		RedisTemplate<String, Object> redisTemplate) {
	
	CompositeCacheManager compositeCacheManager = new CompositeCacheManager();
	List<CacheManager> managers = new ArrayList<CacheManager>();
	managers.add(new EhCacheCacheManager(cm));
	managers.add(new RedisCacheManager(redisTemplate));
	compositeCacheManager.setCacheManagers(managers);//添加缓存管理器,按添加顺序查找,没找到再往下找
	return compositeCacheManager;
}
 
Example #2
Source File: UtilConfiguration.java    From kaif with Apache License 2.0 5 votes vote down vote up
@Bean
@Primary
public CacheManager compositeCacheManager() {
  return new CompositeCacheManager(zoneInfoCacheManager(),
      listHotZonesCacheManager(),
      rssHotArticlesCacheManager(),
      honorRollsCacheManager(),
      articleCacheManager(),
      findClientAppUserCacheManager(),
      listAdministratorsCacheManager());
}