Search in sources :

Example 1 with CopyCacheProxy

use of org.cache2k.jcache.provider.generic.storeByValueSimulation.CopyCacheProxy in project cache2k by cache2k.

the class CacheManagerTest method create_cache2k_config_nowrap.

@Test
public void create_cache2k_config_nowrap() {
    CachingProvider p = Caching.getCachingProvider();
    CacheManager cm = p.getCacheManager();
    Cache<Long, Double> cache = cm.createCache("aCache", ExtendedMutableConfiguration.of(new Cache2kBuilder<Long, Double>() {
    }.entryCapacity(10000).expireAfterWrite(5, TimeUnit.MINUTES)));
    assertFalse(cache instanceof CopyCacheProxy);
    cache.close();
}
Also used : CopyCacheProxy(org.cache2k.jcache.provider.generic.storeByValueSimulation.CopyCacheProxy) CacheManager(javax.cache.CacheManager) Cache2kBuilder(org.cache2k.Cache2kBuilder) CachingProvider(javax.cache.spi.CachingProvider) Test(org.junit.Test)

Example 2 with CopyCacheProxy

use of org.cache2k.jcache.provider.generic.storeByValueSimulation.CopyCacheProxy in project cache2k by cache2k.

the class CacheManagerTest method create_cache2k_config_wrap.

@Test
public void create_cache2k_config_wrap() {
    CachingProvider p = Caching.getCachingProvider();
    CacheManager cm = p.getCacheManager();
    Cache<Long, Double> cache = cm.createCache("aCache", ExtendedMutableConfiguration.of(new Cache2kBuilder<Long, Double>() {
    }.entryCapacity(10000).expireAfterWrite(5, TimeUnit.MINUTES).with(new JCacheConfiguration.Builder().copyAlwaysIfRequested(true))));
    assertTrue(cache instanceof CopyCacheProxy);
    cache.close();
}
Also used : CopyCacheProxy(org.cache2k.jcache.provider.generic.storeByValueSimulation.CopyCacheProxy) Cache2kBuilder(org.cache2k.Cache2kBuilder) CacheManager(javax.cache.CacheManager) CachingProvider(javax.cache.spi.CachingProvider) Test(org.junit.Test)

Aggregations

CacheManager (javax.cache.CacheManager)2 CachingProvider (javax.cache.spi.CachingProvider)2 Cache2kBuilder (org.cache2k.Cache2kBuilder)2 CopyCacheProxy (org.cache2k.jcache.provider.generic.storeByValueSimulation.CopyCacheProxy)2 Test (org.junit.Test)2