当前位置: 首页>>代码示例>>Java>>正文


Java SimpleCacheManager.setCaches方法代码示例

本文整理汇总了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;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:AbstractJCacheTests.java

示例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;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:JCacheJavaConfigTests.java

示例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;
}
 
开发者ID:box,项目名称:mojito,代码行数:12,代码来源:CachingConfig.java

示例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;
}
 
开发者ID:jaspersprengers,项目名称:caching-demo,代码行数:11,代码来源:CacheConfig.java

示例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;
}
 
开发者ID:zheng-zy,项目名称:spring-boot-redis-guava-caffeine-cache,代码行数:20,代码来源:CacheConfig.java

示例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;
}
 
开发者ID:zheng-zy,项目名称:spring-boot-redis-guava-caffeine-cache,代码行数:15,代码来源:GuavaConfig.java

示例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;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:11,代码来源:EnableCachingTests.java

示例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;
}
 
开发者ID:snicoll,项目名称:scratches,代码行数:11,代码来源:JCacheBookRepositoryTest.java

示例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;
}
 
开发者ID:alainsahli,项目名称:spring-cloud-aws-reference-app,代码行数:12,代码来源:ReferenceApplication.java

示例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;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-aws,代码行数:13,代码来源:ElastiCacheCacheConfigurer.java

示例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;
}
 
开发者ID:spring-cloud-samples,项目名称:aws-refapp,代码行数:11,代码来源:ReferenceApplication.java

示例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;
}
 
开发者ID:rafizanbaharum,项目名称:cfi-gov,代码行数:10,代码来源:CfWebAccessConfig.java

示例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;
}
 
开发者ID:vpechorin,项目名称:kontempl,代码行数:10,代码来源:CacheConfig.java


注:本文中的org.springframework.cache.support.SimpleCacheManager.setCaches方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。