Search in sources :

Example 11 with ConfigurationBuilder

use of org.infinispan.configuration.cache.ConfigurationBuilder in project indy by Commonjava.

the class StorageFileIOTest method setup.

@Before
public void setup() throws IOException {
    storageRoot = temp.newFolder("data");
    Properties storageProps = new Properties();
    storageProps.setProperty(StorageFileIO.STORAGE_ROOT_DIR, storageRoot.getAbsolutePath());
    Configuration dataConfig = new ConfigurationBuilder().persistence().passivation(true).addStore(CustomStoreConfigurationBuilder.class).customStoreClass(StorageFileIO.class).properties(storageProps).build();
    String dataName = name.getMethodName() + "-data";
    CACHE_MANAGER.defineConfiguration(dataName, dataConfig);
    Configuration mdConfig = new ConfigurationBuilder().build();
    String metadataName = name.getMethodName() + "-metadata";
    CACHE_MANAGER.defineConfiguration(metadataName, mdConfig);
    dataCache = CACHE_MANAGER.getCache(dataName);
    fs = new GridFilesystem(dataCache, CACHE_MANAGER.getCache(metadataName));
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) CustomStoreConfigurationBuilder(org.infinispan.configuration.cache.CustomStoreConfigurationBuilder) Configuration(org.infinispan.configuration.cache.Configuration) GridFilesystem(org.infinispan.io.GridFilesystem) Properties(java.util.Properties) CustomStoreConfigurationBuilder(org.infinispan.configuration.cache.CustomStoreConfigurationBuilder) Before(org.junit.Before)

Example 12 with ConfigurationBuilder

use of org.infinispan.configuration.cache.ConfigurationBuilder in project adeptj-modules by AdeptJ.

the class InfinispanCacheProvider method initInfinispan.

protected void initInfinispan() {
    long startTime = System.nanoTime();
    if (this.cacheManager == null) {
        Configuration defaultConfiguration = new ConfigurationBuilder().simpleCache(true).eviction().strategy(EvictionStrategy.LRU).type(EvictionType.COUNT).size(1000l).expiration().lifespan(60, TimeUnit.MINUTES).maxIdle(30, TimeUnit.MINUTES).build();
        this.cacheManager = new DefaultCacheManager(defaultConfiguration);
        LOGGER.info("Infinispan initialization took: [{}] ms!!", TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime));
    }
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) DefaultCacheManager(org.infinispan.manager.DefaultCacheManager) Configuration(org.infinispan.configuration.cache.Configuration)

Example 13 with ConfigurationBuilder

use of org.infinispan.configuration.cache.ConfigurationBuilder in project teiid by teiid.

the class HotRodTestServer method getConfigurationBuilder.

protected ConfigurationBuilder getConfigurationBuilder() {
    ConfigurationBuilder builder = new ConfigurationBuilder();
    builder.indexing().index(Index.ALL).addProperty("default.directory_provider", "ram").addProperty("lucene_version", "LUCENE_CURRENT");
    return builder;
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) HotRodServerConfigurationBuilder(org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder)

Example 14 with ConfigurationBuilder

use of org.infinispan.configuration.cache.ConfigurationBuilder in project galley by Commonjava.

the class NFSOwnerCacheProducer method getCacheMgr.

public EmbeddedCacheManager getCacheMgr() {
    final EmbeddedCacheManager cacheManager = new DefaultCacheManager(new GlobalConfigurationBuilder().globalJmxStatistics().jmxDomain("org.commonjava.maven.galley").build());
    // Want to enable dead lock check as lock will be used in FastLocalCacheProvider
    // and also set transaction mode to PESSIMISTIC with DummyTransactionManger.
    final Configuration configurationForNfs = new ConfigurationBuilder().eviction().strategy(EvictionStrategy.LRU).size(1000).type(EvictionType.COUNT).deadlockDetection().spinDuration(10, TimeUnit.SECONDS).enable().transaction().transactionManagerLookup(new DummyTransactionManagerLookup()).lockingMode(LockingMode.PESSIMISTIC).build();
    cacheManager.defineConfiguration(CACHE_NAME, configurationForNfs);
    // Default cache impl for the local file cache in FLCP, uses 7 day as an expiration duration, and trigger purge every 30 mins.
    final Long expirationDuration = 7 * 24 * 3600 * 1000L;
    Configuration configForLocalFile = new ConfigurationBuilder().eviction().strategy(EvictionStrategy.LRU).size(20000).type(EvictionType.COUNT).expiration().lifespan(expirationDuration).wakeUpInterval(30 * 60 * 1000L).maxIdle(expirationDuration).build();
    cacheManager.defineConfiguration(DEFAULT_LOCAL_CACHE_FILE_NAME, configForLocalFile);
    // A test cache impl to do unit-testing for this local file cache expiration for purging mechanism
    Configuration configForLocalFileTest = new ConfigurationBuilder().eviction().strategy(EvictionStrategy.LRU).size(1000).type(EvictionType.COUNT).expiration().lifespan(1000L).wakeUpInterval(100L).maxIdle(1000L).build();
    cacheManager.defineConfiguration(LOCAL_CACHE_FILE_NAME_FOR_TEST, configForLocalFileTest);
    return cacheManager;
}
Also used : GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) DummyTransactionManagerLookup(org.infinispan.transaction.lookup.DummyTransactionManagerLookup) DefaultCacheManager(org.infinispan.manager.DefaultCacheManager) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) Configuration(org.infinispan.configuration.cache.Configuration) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager)

Example 15 with ConfigurationBuilder

use of org.infinispan.configuration.cache.ConfigurationBuilder in project indy by Commonjava.

the class KojiMavenMetadataProviderTest method setupClass.

@BeforeClass
public static void setupClass() {
    cacheManager = new DefaultCacheManager(new ConfigurationBuilder().simpleCache(true).build());
    contentMetadata = cacheManager.getCache("content-metadata", true);
}
Also used : DefaultCacheManager(org.infinispan.manager.DefaultCacheManager) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) BeforeClass(org.junit.BeforeClass)

Aggregations

ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)53 Configuration (org.infinispan.configuration.cache.Configuration)24 Test (org.junit.Test)19 GlobalConfigurationBuilder (org.infinispan.configuration.global.GlobalConfigurationBuilder)14 DefaultCacheManager (org.infinispan.manager.DefaultCacheManager)12 ClusteringConfigurationBuilder (org.infinispan.configuration.cache.ClusteringConfigurationBuilder)7 GlobalConfiguration (org.infinispan.configuration.global.GlobalConfiguration)7 Properties (java.util.Properties)6 Map (java.util.Map)5 InfinispanRegionFactory (org.hibernate.cache.infinispan.InfinispanRegionFactory)5 TimestampsRegionImpl (org.hibernate.cache.infinispan.timestamp.TimestampsRegionImpl)5 BeforeClass (org.junit.BeforeClass)5 AdvancedCache (org.infinispan.AdvancedCache)4 BackupConfigurationBuilder (org.infinispan.configuration.cache.BackupConfigurationBuilder)4 CacheMode (org.infinispan.configuration.cache.CacheMode)4 SitesConfigurationBuilder (org.infinispan.configuration.cache.SitesConfigurationBuilder)3 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)3 HashMap (java.util.HashMap)2 Consumer (java.util.function.Consumer)2 CacheProducer (org.commonjava.indy.subsys.infinispan.CacheProducer)2