use of org.infinispan.configuration.cache.ConfigurationBuilder in project openolat by klemens.
the class InfinispanCacher method createInfinispanConfiguration.
private void createInfinispanConfiguration(String cacheName) {
Configuration conf = cacheManager.getCacheConfiguration(cacheName);
if (conf == null) {
long maxEntries = 10000;
long maxIdle = 900000l;
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.eviction().strategy(EvictionStrategy.LRU);
builder.eviction().type(EvictionType.COUNT).size(maxEntries);
builder.expiration().maxIdle(maxIdle);
builder.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL);
builder.dataContainer().storeAsBinary().storeValuesAsBinary(false);
builder.locking().concurrencyLevel(1000);
builder.locking().useLockStriping(false);
builder.locking().lockAcquisitionTimeout(15000);
builder.locking().isolationLevel(IsolationLevel.READ_COMMITTED);
builder.jmxStatistics().enable();
Configuration configurationOverride = builder.build();
cacheManager.defineConfiguration(cacheName, configurationOverride);
}
}
use of org.infinispan.configuration.cache.ConfigurationBuilder in project indy by Commonjava.
the class MetadataCacheManagerTest method setup.
@Before
public void setup() throws Exception {
DefaultCacheManager cacheManager = new DefaultCacheManager(new ConfigurationBuilder().simpleCache(true).build());
cacheProducer = new CacheProducer(null, cacheManager, null);
CacheHandle<MetadataKey, MetadataKey> metadataKeyCache = cacheProducer.getCache("maven-metadata-key-cache");
CacheHandle<MetadataKey, MetadataInfo> metadataCache = cacheProducer.getCache("maven-metadata-cache");
metadataCacheManager = new MetadataCacheManager(metadataCache, metadataKeyCache);
}
use of org.infinispan.configuration.cache.ConfigurationBuilder in project indy by Commonjava.
the class InfinispanTCKFixtureProvider method init.
protected void init() {
DefaultCacheManager cacheManager = new DefaultCacheManager(new ConfigurationBuilder().simpleCache(true).build());
Cache<StoreKey, ArtifactStore> storeCache = cacheManager.getCache(STORE_DATA_CACHE, true);
Cache<String, Map<StoreType, Set<StoreKey>>> storesByPkgCache = cacheManager.getCache(STORE_BY_PKG_CACHE, true);
Cache<StoreKey, Set<StoreKey>> affected = cacheManager.getCache(AFFECTED_BY_STORE_CACHE, true);
dataManager = new InfinispanStoreDataManager(storeCache, storesByPkgCache, affected);
}
use of org.infinispan.configuration.cache.ConfigurationBuilder in project wildfly by wildfly.
the class CacheEntryMutatorTestCase method mutateNonTransactional.
@Test
public void mutateNonTransactional() {
AdvancedCache<Object, Object> cache = mock(AdvancedCache.class);
Object id = new Object();
Object value = new Object();
Configuration config = new ConfigurationBuilder().transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL).build();
when(cache.getCacheConfiguration()).thenReturn(config);
Mutator mutator = new CacheEntryMutator<>(cache, id, value);
when(cache.getAdvancedCache()).thenReturn(cache);
when(cache.withFlags(Flag.IGNORE_RETURN_VALUES, Flag.FAIL_SILENTLY)).thenReturn(cache);
mutator.mutate();
verify(cache).put(same(id), same(value));
mutator.mutate();
verify(cache, times(2)).put(same(id), same(value));
mutator.mutate();
verify(cache, times(3)).put(same(id), same(value));
}
use of org.infinispan.configuration.cache.ConfigurationBuilder in project wildfly by wildfly.
the class InfinispanCachePropertiesTestCase method isTransactional.
@Test
public void isTransactional() {
Configuration config = new ConfigurationBuilder().transaction().transactionMode(TransactionMode.TRANSACTIONAL).build();
Assert.assertTrue(new InfinispanCacheProperties(config).isTransactional());
config = new ConfigurationBuilder().transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL).build();
Assert.assertFalse(new InfinispanCacheProperties(config).isTransactional());
}
Aggregations