本文整理汇总了Java中org.springframework.cache.support.SimpleCacheManager.setCaches方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleCacheManager.setCaches方法的具体用法?Java SimpleCacheManager.setCaches怎么用?Java SimpleCacheManager.setCaches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.cache.support.SimpleCacheManager
的用法示例。
在下文中一共展示了SimpleCacheManager.setCaches方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cacheManager
import org.springframework.cache.support.SimpleCacheManager; //导入方法依赖的package包/类
@Bean
public CacheManager cacheManager() {
SimpleCacheManager mgr = new SimpleCacheManager();
ArrayList<Cache> caches = new ArrayList<Cache>();
caches.add(new ConcurrentMapCache(""));
mgr.setCaches(caches);
return mgr;
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:9,代码来源:EnableTransactionManagementIntegrationTests.java
示例2: createSimpleCacheManager
import org.springframework.cache.support.SimpleCacheManager; //导入方法依赖的package包/类
protected static CacheManager createSimpleCacheManager(String... cacheNames) {
SimpleCacheManager result = new SimpleCacheManager();
List<Cache> caches = new ArrayList<Cache>();
for (String cacheName : cacheNames) {
caches.add(new ConcurrentMapCache(cacheName));
}
result.setCaches(caches);
result.afterPropertiesSet();
return result;
}
示例3: cacheManager
import org.springframework.cache.support.SimpleCacheManager; //导入方法依赖的package包/类
@Bean
public CacheManager cacheManager() {
SimpleCacheManager cm = new SimpleCacheManager();
cm.setCaches(Arrays.asList(
defaultCache(),
new ConcurrentMapCache("primary"),
new ConcurrentMapCache("secondary"),
new ConcurrentMapCache("exception")));
return cm;
}
示例4: cacheManager
import org.springframework.cache.support.SimpleCacheManager; //导入方法依赖的package包/类
@Bean
@Override
public CacheManager cacheManager() {
Cache defaultCache = new ConcurrentMapCache("default");
Cache localesCache = new ConcurrentMapCache("locales");
SimpleCacheManager manager = new SimpleCacheManager();
manager.setCaches(Arrays.asList(defaultCache, localesCache));
return manager;
}
示例5: cacheManager
import org.springframework.cache.support.SimpleCacheManager; //导入方法依赖的package包/类
@Bean
public CacheManager cacheManager() {
SimpleCacheManager simpleCacheManager = new SimpleCacheManager();
simpleCacheManager.setCaches(Arrays.asList(
buildPostCodeCache(),
buildTemperatureCache(),
buildSharesCache()
));
return simpleCacheManager;
}
示例6: cacheManager
import org.springframework.cache.support.SimpleCacheManager; //导入方法依赖的package包/类
/**
* 个性化配置缓存
*/
@Bean
public CacheManager cacheManager() {
SimpleCacheManager manager = new SimpleCacheManager();
//把各个cache注册到cacheManager中,CaffeineCache实现了org.springframework.cache.Cache接口
ArrayList<CaffeineCache> caches = new ArrayList<>();
for (Caches c : Caches.values()) {
caches.add(new CaffeineCache(c.name(),
Caffeine.newBuilder().recordStats()
.expireAfterWrite(c.getTtl(), TimeUnit.SECONDS)
.maximumSize(c.getMaxSize())
.build())
);
}
manager.setCaches(caches);
return manager;
}
示例7: cacheManager
import org.springframework.cache.support.SimpleCacheManager; //导入方法依赖的package包/类
/**
* 个性化配置缓存
*/
@Bean
public CacheManager cacheManager() {
SimpleCacheManager manager = new SimpleCacheManager();
//把各个cache注册到cacheManager中,GuavaCache实现了org.springframework.cache.Cache接口
ArrayList<GuavaCache> caches = new ArrayList<>();
for (Caches c : Caches.values()) {
caches.add(new GuavaCache(c.name(), CacheBuilder.newBuilder().recordStats().expireAfterWrite(c.getTtl(), TimeUnit.SECONDS).maximumSize(c.getMaxSize()).build()));
}
manager.setCaches(caches);
return manager;
}
示例8: cacheManager
import org.springframework.cache.support.SimpleCacheManager; //导入方法依赖的package包/类
@Bean
@Override
public CacheManager cacheManager() {
CompositeCacheManager compositeCacheManager = new CompositeCacheManager();
List<CacheManager> cacheManagers = Lists.newArrayList();
SimpleCacheManager simpleCacheManager = new SimpleCacheManager();
simpleCacheManager.setCaches(Collections.singletonList(
new ConcurrentMapCache("cache")
));
if (this.couchbaseCacheManager != null) {
cacheManagers.add(this.couchbaseCacheManager);
cacheManagers.add(simpleCacheManager);
}
compositeCacheManager.setCacheManagers(cacheManagers);
compositeCacheManager.setFallbackToNoOpCache(true);
return compositeCacheManager;
}
开发者ID:kbastani,项目名称:spring-cloud-polyglot-persistence-example,代码行数:23,代码来源:CachingConfiguration.java
示例9: cacheManager
import org.springframework.cache.support.SimpleCacheManager; //导入方法依赖的package包/类
@Override
@Bean
public CacheManager cacheManager() {
SimpleCacheManager cm = new SimpleCacheManager();
cm.setCaches(Arrays.asList(
new ConcurrentMapCache("default"),
new ConcurrentMapCache("primary"),
new ConcurrentMapCache("secondary")));
return cm;
}
示例10: cacheManager
import org.springframework.cache.support.SimpleCacheManager; //导入方法依赖的package包/类
@Bean
@Override
public CacheManager cacheManager() {
SimpleCacheManager manager = new SimpleCacheManager();
manager.setCaches(asList(
new ConcurrentMapCache("default"),
new ConcurrentMapCache("another"))
);
return manager;
}
示例11: createSimpleCacheManager
import org.springframework.cache.support.SimpleCacheManager; //导入方法依赖的package包/类
@Bean
@Profile("local")
public CacheManager createSimpleCacheManager() {
SimpleCacheManager simpleCacheManager = new SimpleCacheManager();
List<Cache> caches = new ArrayList<>(2);
caches.add(new ConcurrentMapCache("CacheCluster"));
caches.add(new ConcurrentMapCache("GitHubSourceCode"));
simpleCacheManager.setCaches(caches);
return simpleCacheManager;
}
示例12: cacheManager
import org.springframework.cache.support.SimpleCacheManager; //导入方法依赖的package包/类
@Override
public CacheManager cacheManager() {
List<Cache> caches = new ArrayList<>(this.cacheNames.size());
for (String cacheName : this.cacheNames) {
caches.add(clusterCache(cacheName));
}
SimpleCacheManager simpleCacheManager = new SimpleCacheManager();
simpleCacheManager.setCaches(caches);
simpleCacheManager.afterPropertiesSet();
return simpleCacheManager;
}
示例13: createSimpleCacheManager
import org.springframework.cache.support.SimpleCacheManager; //导入方法依赖的package包/类
@Bean
public CacheManager createSimpleCacheManager() {
SimpleCacheManager simpleCacheManager = new SimpleCacheManager();
List<Cache> caches = new ArrayList<>(2);
caches.add(new ConcurrentMapCache("CacheCluster"));
caches.add(new ConcurrentMapCache("GitHubSourceCode"));
simpleCacheManager.setCaches(caches);
return simpleCacheManager;
}
示例14: cacheManager
import org.springframework.cache.support.SimpleCacheManager; //导入方法依赖的package包/类
@Bean
public CacheManager cacheManager() {
SimpleCacheManager simpleCacheManager = new SimpleCacheManager();
net.sf.ehcache.Cache aDefault1 = new net.sf.ehcache.Cache("default", 10000, true, false, 1000, 1000, false, 1000);
aDefault1.initialise();
EhCacheCache aDefault = new EhCacheCache(aDefault1);
simpleCacheManager.setCaches(Arrays.asList(aDefault));
return simpleCacheManager;
}
示例15: cacheManager
import org.springframework.cache.support.SimpleCacheManager; //导入方法依赖的package包/类
@Bean
public CacheManager cacheManager(Ticker ticker) {
CaffeineCache pageCache = buildCache("pageCache", ticker, 14400, 100);
CaffeineCache siteCache = buildCache("siteCache", ticker, 14400, 10);
CaffeineCache treeCache = buildCache("treeCache", ticker, 14400, 4);
SimpleCacheManager manager = new SimpleCacheManager();
manager.setCaches(Arrays.asList(pageCache, siteCache, treeCache));
return manager;
}