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


Java SimpleCacheManager类代码示例

本文整理汇总了Java中org.springframework.cache.support.SimpleCacheManager的典型用法代码示例。如果您正苦于以下问题:Java SimpleCacheManager类的具体用法?Java SimpleCacheManager怎么用?Java SimpleCacheManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SimpleCacheManager类属于org.springframework.cache.support包,在下文中一共展示了SimpleCacheManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: genericCacheWithCaches

import org.springframework.cache.support.SimpleCacheManager; //导入依赖的package包/类
@Test
public void genericCacheWithCaches() {
	load(GenericCacheConfiguration.class);
	SimpleCacheManager cacheManager = validateCacheManager(SimpleCacheManager.class);
	assertThat(cacheManager.getCache("first"))
			.isEqualTo(this.context.getBean("firstCache"));
	assertThat(cacheManager.getCache("second"))
			.isEqualTo(this.context.getBean("secondCache"));
	assertThat(cacheManager.getCacheNames()).hasSize(2);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:CacheAutoConfigurationTests.java

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: genericCacheExplicitWithCaches

import org.springframework.cache.support.SimpleCacheManager; //导入依赖的package包/类
@Test
public void genericCacheExplicitWithCaches() {
	load(GenericCacheConfiguration.class, "spring.cache.type=generic");
	SimpleCacheManager cacheManager = validateCacheManager(SimpleCacheManager.class);
	assertThat(cacheManager.getCache("first"))
			.isEqualTo(this.context.getBean("firstCache"));
	assertThat(cacheManager.getCache("second"))
			.isEqualTo(this.context.getBean("secondCache"));
	assertThat(cacheManager.getCacheNames()).hasSize(2);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:CacheAutoConfigurationTests.java

示例7: 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

示例8: 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

示例9: 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

示例10: genericCacheWithCaches

import org.springframework.cache.support.SimpleCacheManager; //导入依赖的package包/类
@Test
public void genericCacheWithCaches() {
	load(GenericCacheConfiguration.class);
	SimpleCacheManager cacheManager = validateCacheManager(SimpleCacheManager.class);
	assertThat(cacheManager.getCache("first"),
			equalTo(this.context.getBean("firstCache")));
	assertThat(cacheManager.getCache("second"),
			equalTo(this.context.getBean("secondCache")));
	assertThat(cacheManager.getCacheNames(), hasSize(2));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:11,代码来源:CacheAutoConfigurationTests.java

示例11: genericCacheExplicitWithCaches

import org.springframework.cache.support.SimpleCacheManager; //导入依赖的package包/类
@Test
public void genericCacheExplicitWithCaches() {
	load(GenericCacheConfiguration.class, "spring.cache.type=generic");
	SimpleCacheManager cacheManager = validateCacheManager(SimpleCacheManager.class);
	assertThat(cacheManager.getCache("first"),
			equalTo(this.context.getBean("firstCache")));
	assertThat(cacheManager.getCache("second"),
			equalTo(this.context.getBean("secondCache")));
	assertThat(cacheManager.getCacheNames(), hasSize(2));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:11,代码来源:CacheAutoConfigurationTests.java

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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