use of org.springframework.cache.CacheManager in project nextprot-api by calipho-sib.
the class SpringConfig method startApplicationContext.
public void startApplicationContext() {
System.setProperty("spring.profiles.active", profiles);
ctx = new ClassPathXmlApplicationContext(getXmlConfigResourceLocations());
if (profiles.contains("cache")) {
cacheManager = ctx.getBean(CacheManager.class);
LOGGER.info("cache manager startup");
}
}
use of org.springframework.cache.CacheManager in project xm-ms-entity by xm-online.
the class CacheConfiguration method cacheManager.
@Bean
public CacheManager cacheManager(HazelcastInstance hazelcastInstance) {
log.debug("Starting HazelcastCacheManager");
CacheManager cacheManager = new com.hazelcast.spring.cache.HazelcastCacheManager(hazelcastInstance);
return cacheManager;
}
use of org.springframework.cache.CacheManager in project spring-framework by spring-projects.
the class CaffeineCacheManagerTests method testDynamicMode.
@Test
public void testDynamicMode() {
CacheManager cm = new CaffeineCacheManager();
Cache cache1 = cm.getCache("c1");
boolean condition2 = cache1 instanceof CaffeineCache;
assertThat(condition2).isTrue();
Cache cache1again = cm.getCache("c1");
assertThat(cache1).isSameAs(cache1again);
Cache cache2 = cm.getCache("c2");
boolean condition1 = cache2 instanceof CaffeineCache;
assertThat(condition1).isTrue();
Cache cache2again = cm.getCache("c2");
assertThat(cache2).isSameAs(cache2again);
Cache cache3 = cm.getCache("c3");
boolean condition = cache3 instanceof CaffeineCache;
assertThat(condition).isTrue();
Cache cache3again = cm.getCache("c3");
assertThat(cache3).isSameAs(cache3again);
cache1.put("key1", "value1");
assertThat(cache1.get("key1").get()).isEqualTo("value1");
cache1.put("key2", 2);
assertThat(cache1.get("key2").get()).isEqualTo(2);
cache1.put("key3", null);
assertThat(cache1.get("key3").get()).isNull();
cache1.evict("key3");
assertThat(cache1.get("key3")).isNull();
}
use of org.springframework.cache.CacheManager in project spring-framework by spring-projects.
the class AbstractCacheAnnotationTests method testCustomCacheManager.
@Test
public void testCustomCacheManager() {
CacheManager customCm = this.ctx.getBean("customCacheManager", CacheManager.class);
Object key = new Object();
Object r1 = this.cs.customCacheManager(key);
assertThat(this.cs.customCacheManager(key)).isSameAs(r1);
Cache cache = customCm.getCache("testCache");
assertThat(cache.get(key)).isNotNull();
}
use of org.springframework.cache.CacheManager in project spring-framework by spring-projects.
the class AbstractCacheAnnotationTests method testCustomCacheManager.
@Test
public void testCustomCacheManager() {
CacheManager customCm = this.ctx.getBean("customCacheManager", CacheManager.class);
Object key = new Object();
Object r1 = this.cs.customCacheManager(key);
assertThat(this.cs.customCacheManager(key)).isSameAs(r1);
Cache cache = customCm.getCache("testCache");
assertThat(cache.get(key)).isNotNull();
}
Aggregations