use of net.sf.ehcache.config.CacheConfiguration in project dble by actiontech.
the class TestCachePoolPerformance method createEnCachePool.
public static CachePool createEnCachePool() {
CacheConfiguration cacheConf = new CacheConfiguration();
cacheConf.setName("testcache");
cacheConf.maxBytesLocalHeap(400, MemoryUnit.MEGABYTES).timeToIdleSeconds(3600);
Cache cache = new Cache(cacheConf);
CacheManager.create().addCache(cache);
EnchachePool enCachePool = new EnchachePool(cacheConf.getName(), cache, 400 * 10000);
return enCachePool;
}
use of net.sf.ehcache.config.CacheConfiguration in project joynr by bmwcarit.
the class DomainAccessControlStoreEhCache method createAclCache.
private Cache createAclCache(CacheId cacheId) {
// configure cache as searchable
CacheConfiguration cacheConfig = new CacheConfiguration(cacheId.getIdAsString(), 0).eternal(true);
Searchable searchable = new Searchable();
cacheConfig.addSearchable(searchable);
// register searchable attributes
searchable.addSearchAttribute(new SearchAttribute().name(UserDomainInterfaceOperationKey.USER_ID));
searchable.addSearchAttribute(new SearchAttribute().name(UserDomainInterfaceOperationKey.DOMAIN));
searchable.addSearchAttribute(new SearchAttribute().name(UserDomainInterfaceOperationKey.INTERFACE));
searchable.addSearchAttribute(new SearchAttribute().name(UserDomainInterfaceOperationKey.OPERATION));
cacheManager.addCache(new Cache(cacheConfig));
return cacheManager.getCache(cacheId.getIdAsString());
}
use of net.sf.ehcache.config.CacheConfiguration in project cloudbreak by hortonworks.
the class UserCache method cacheConfiguration.
@Override
public CacheConfiguration cacheConfiguration() {
CacheConfiguration cacheConfiguration = new CacheConfiguration();
cacheConfiguration.setName("userCache");
cacheConfiguration.setMemoryStoreEvictionPolicy("LRU");
cacheConfiguration.setMaxEntriesLocalHeap(MAX_ENTRIES);
cacheConfiguration.setTimeToLiveSeconds(TTL_IN_SECONDS);
return cacheConfiguration;
}
use of net.sf.ehcache.config.CacheConfiguration in project cloudbreak by hortonworks.
the class CloudResourceRegionCache method cacheConfiguration.
@Override
public CacheConfiguration cacheConfiguration() {
CacheConfiguration cacheConfiguration = new CacheConfiguration();
cacheConfiguration.setName("cloudResourceRegionCache");
cacheConfiguration.setMemoryStoreEvictionPolicy("LRU");
cacheConfiguration.setMaxEntriesLocalHeap(MAX_ENTRIES);
return cacheConfiguration;
}
use of net.sf.ehcache.config.CacheConfiguration in project cloudbreak by hortonworks.
the class ImageCatalogCache method cacheConfiguration.
@Override
public CacheConfiguration cacheConfiguration() {
CacheConfiguration cacheConfiguration = new CacheConfiguration();
cacheConfiguration.setName("imageCatalogCache");
cacheConfiguration.setMemoryStoreEvictionPolicy("LRU");
cacheConfiguration.setMaxEntriesLocalHeap(MAX_ENTRIES);
// Cache cannot be turned off, the default value is 0, which means no timeToLive (TTL) eviction takes place (infinite lifetime).
cacheConfiguration.setTimeToLiveSeconds(ttlMinutes == 0L ? 1 : TimeUnit.MINUTES.toSeconds(ttlMinutes));
return cacheConfiguration;
}
Aggregations