use of com.couchbase.client.spring.cache.CouchbaseCacheManager in project spring-boot by spring-projects.
the class CacheAutoConfigurationTests method couchbaseCacheExplicit.
@Test
public void couchbaseCacheExplicit() {
load(CouchbaseCacheConfiguration.class, "spring.cache.type=couchbase");
CouchbaseCacheManager cacheManager = validateCacheManager(CouchbaseCacheManager.class);
assertThat(cacheManager.getCacheNames()).isEmpty();
}
use of com.couchbase.client.spring.cache.CouchbaseCacheManager in project spring-boot by spring-projects.
the class CouchbaseCacheConfiguration method cacheManager.
@Bean
public CouchbaseCacheManager cacheManager() {
List<String> cacheNames = this.cacheProperties.getCacheNames();
CouchbaseCacheManager cacheManager = new CouchbaseCacheManager(CacheBuilder.newInstance(this.bucket).withExpiration(this.cacheProperties.getCouchbase().getExpirationSeconds()), cacheNames.toArray(new String[cacheNames.size()]));
return this.customizers.customize(cacheManager);
}
use of com.couchbase.client.spring.cache.CouchbaseCacheManager in project spring-boot by spring-projects.
the class CacheAutoConfigurationTests method couchbaseCacheExplicitWithTtl.
@Test
public void couchbaseCacheExplicitWithTtl() {
load(CouchbaseCacheConfiguration.class, "spring.cache.type=couchbase", "spring.cache.cacheNames=foo,bar", "spring.cache.couchbase.expiration=2000");
CouchbaseCacheManager cacheManager = validateCacheManager(CouchbaseCacheManager.class);
assertThat(cacheManager.getCacheNames()).containsOnly("foo", "bar");
Cache cache = cacheManager.getCache("foo");
assertThat(cache).isInstanceOf(CouchbaseCache.class);
assertThat(((CouchbaseCache) cache).getTtl()).isEqualTo(2);
assertThat(((CouchbaseCache) cache).getNativeCache()).isEqualTo(this.context.getBean("bucket"));
}
use of com.couchbase.client.spring.cache.CouchbaseCacheManager in project spring-boot by spring-projects.
the class CacheAutoConfigurationTests method couchbaseCacheExplicitWithCaches.
@Test
public void couchbaseCacheExplicitWithCaches() {
load(CouchbaseCacheConfiguration.class, "spring.cache.type=couchbase", "spring.cache.cacheNames[0]=foo", "spring.cache.cacheNames[1]=bar");
CouchbaseCacheManager cacheManager = validateCacheManager(CouchbaseCacheManager.class);
assertThat(cacheManager.getCacheNames()).containsOnly("foo", "bar");
Cache cache = cacheManager.getCache("foo");
assertThat(cache).isInstanceOf(CouchbaseCache.class);
assertThat(((CouchbaseCache) cache).getTtl()).isEqualTo(0);
assertThat(((CouchbaseCache) cache).getNativeCache()).isEqualTo(this.context.getBean("bucket"));
}
Aggregations