use of net.sf.ehcache.config.TerracottaConfiguration in project ff4j by ff4j.
the class FeatureStoreTerracottaTestIT method initStore.
/**
* {@inheritDoc}
*/
@Override
protected FeatureStore initStore() {
// Configuration to wirk with Terracotta
Configuration managerConfiguration = new Configuration();
managerConfiguration.name("config").terracotta(new TerracottaClientConfiguration().url(TERRACOTTA_URL)).defaultCache(new CacheConfiguration().maxBytesLocalHeap(128, MemoryUnit.MEGABYTES).terracotta(new TerracottaConfiguration())).cache(new CacheConfiguration().name(FF4jEhCacheWrapper.CACHENAME_FEATURES).maxBytesLocalHeap(128, MemoryUnit.MEGABYTES).terracotta(new TerracottaConfiguration()));
FeatureStoreEhCache ehcacheStore = new FeatureStoreEhCache(managerConfiguration);
ehcacheStore.importFeaturesFromXmlFile("ff4j.xml");
return ehcacheStore;
}
use of net.sf.ehcache.config.TerracottaConfiguration in project onebusaway-application-modules by camsys.
the class EhCacheFactoryBean method createCache.
/**
* Create a raw Cache object based on the configuration of this FactoryBean.
*/
private Cache createCache() {
CacheConfiguration config = new CacheConfiguration(this.cacheName, this.maxElementsInMemory);
config.setMemoryStoreEvictionPolicyFromObject(this.memoryStoreEvictionPolicy);
config.setEternal(this.eternal);
config.setTimeToLiveSeconds(this.timeToLive);
config.setTimeToIdleSeconds(this.timeToIdle);
PersistenceConfiguration pc = new PersistenceConfiguration();
if (this.diskPersistent)
pc.strategy(PersistenceConfiguration.Strategy.LOCALRESTARTABLE);
else if (this.overflowToDisk)
pc.strategy(PersistenceConfiguration.Strategy.LOCALTEMPSWAP);
else
pc.strategy(PersistenceConfiguration.Strategy.NONE);
config.setDiskExpiryThreadIntervalSeconds(this.diskExpiryThreadIntervalSeconds);
config.setMaxElementsOnDisk(this.maxElementsOnDisk);
if (this.terracottaClustered) {
TerracottaConfiguration tcConfig = new TerracottaConfiguration();
tcConfig.setClustered(true);
config.terracotta(tcConfig);
}
return new Cache(config);
}
Aggregations