use of com.couchbase.client.spring.cache.CouchbaseCache 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.CouchbaseCache 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