use of org.infinispan.cache.impl.DecoratedCache in project camel by apache.
the class InfinispanManager method getCache.
public BasicCache<Object, Object> getCache(String cacheName) {
if (cacheName == null) {
cacheName = configuration.getCacheName();
}
LOGGER.trace("Cache[{}]", cacheName);
BasicCache<Object, Object> cache = InfinispanUtil.getCache(cacheContainer, cacheName);
if (configuration.hasFlags() && InfinispanUtil.isEmbedded(cache)) {
cache = new DecoratedCache(InfinispanUtil.asAdvanced(cache), configuration.getFlags());
}
return cache;
}
use of org.infinispan.cache.impl.DecoratedCache in project camel by apache.
the class InfinispanConfigurationTestIT method embeddedCacheWithFlagsTest.
@Test
public void embeddedCacheWithFlagsTest() throws Exception {
InfinispanConfiguration configuration = new InfinispanConfiguration();
configuration.setHost("localhost");
configuration.setCacheName("misc_cache");
configuration.setCacheContainer(new DefaultCacheManager(true));
configuration.setFlags(org.infinispan.context.Flag.SKIP_CACHE_LOAD, org.infinispan.context.Flag.SKIP_CACHE_STORE);
InfinispanManager manager = new InfinispanManager(configuration);
manager.start();
BasicCache<Object, Object> cache = manager.getCache();
assertNotNull(cache);
assertTrue(cache instanceof DecoratedCache);
DecoratedCache<Object, Object> decoratedCache = (DecoratedCache<Object, Object>) cache;
assertTrue(decoratedCache.getFlags().contains(org.infinispan.context.Flag.SKIP_CACHE_LOAD));
assertTrue(decoratedCache.getFlags().contains(org.infinispan.context.Flag.SKIP_CACHE_STORE));
manager.getCacheContainer().stop();
manager.stop();
}
Aggregations