private static CacheConfiguration cacheConfiguration() { return new CacheConfiguration(CACHE_NAME, 2048) .persistence(new PersistenceConfiguration().strategy(PersistenceConfiguration.Strategy.NONE)) .timeToIdleSeconds(120) .timeToLiveSeconds(0) .eternal(false) .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LRU); }
timeToIdleSeconds(86400).// diskExpiryThreadIntervalSeconds(0).//
.eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds));
.eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds) .diskPersistent(diskPersistent) .diskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds)
.eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds) .diskPersistent(diskPersistent) .diskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds)); .eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds) .diskPersistent(diskPersistent) .diskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds), .eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds) .diskPersistent(diskPersistent) .diskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds), .eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds) .diskPersistent(diskPersistent) .diskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds) .eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds) .diskPersistent(diskPersistent) .diskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds)
.eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds));
.eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds));
.eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds));
protected HttpCache(String name) { CacheManager manager = CacheManager.getInstance(); this._cache = new Cache( new CacheConfiguration(name, 10000) .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU) .eternal(false) .timeToLiveSeconds(3600) .timeToIdleSeconds(1200) .diskExpiryThreadIntervalSeconds(0) .persistence(new PersistenceConfiguration().strategy(Strategy.LOCALTEMPSWAP))); manager.addCache(this._cache); }
boolean isEternal = serverConfigurationService.getBoolean(clusterConfigName + ".eternal", false); if (isEternal) { clusterCache.eternal(true).timeToIdleSeconds(0).timeToLiveSeconds(0); } else { clusterCache.eternal(false) .timeToIdleSeconds(serverConfigurationService.getInt(clusterConfigName + ".timeToIdle", DEFAULT_CACHE_TIMEOUT)) .timeToLiveSeconds(serverConfigurationService.getInt(clusterConfigName + ".timeToLive", DEFAULT_CACHE_TIMEOUT));
public LocalCacheManager(String name, int max, int exptime, boolean copyOnRead, boolean copyOnWrite) { this.cache = CacheManager.getInstance().getCache(name); if (cache == null) { CacheConfiguration config = new CacheConfiguration(name, max) .copyOnRead(copyOnRead) .copyOnWrite(copyOnWrite) .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LRU) .eternal(false) .timeToLiveSeconds(exptime) .timeToIdleSeconds(exptime) .diskExpiryThreadIntervalSeconds(60) .persistence(new PersistenceConfiguration().strategy(PersistenceConfiguration.Strategy.NONE)); this.cache = new Cache(config, null, null); CacheManager.getInstance().addCache(cache); if (logger.isInfoEnabled()) { logger.info("Arcus k/v local cache is enabled : %s", cache.toString()); } } }
config.timeToIdleSeconds(SECONDS.convert(settings.getExpireAfterAccess(), MILLISECONDS));
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; }
Configuration ehCacheConfig = new Configuration(); ehCacheConfig.setName(cacheName); CacheConfiguration defaultCache = new CacheConfiguration(cacheName, 1).eternal(false).timeToIdleSeconds(30) .timeToLiveSeconds(30).overflowToDisk(false); ehCacheConfig.addDefaultCache(defaultCache);
CacheConfiguration defaultCache = new CacheConfiguration("default", 1).eternal(false).timeToIdleSeconds(30) .timeToLiveSeconds(30).overflowToDisk(false); ehCacheConfig.addDefaultCache(defaultCache);
.eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds) .diskPersistent(diskPersistent) .diskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds)
.eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds) .diskPersistent(diskPersistent) .diskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds)
.eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds) .diskPersistent(diskPersistent) .diskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds)
new CacheConfiguration().name( getName() ).memoryStoreEvictionPolicy( getMemoryStoreEvictionPolicy() ).eternal( isEternal() ).timeToLiveSeconds( getTimeToLiveSeconds() ).timeToIdleSeconds( getTimeToIdleSeconds() ).diskExpiryThreadIntervalSeconds( getDiskExpiryThreadIntervalSeconds() ).overflowToOffHeap(
.eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds) .diskPersistent(diskPersistent) .diskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds)); .eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds) .diskPersistent(diskPersistent) .diskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds), .eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds) .diskPersistent(diskPersistent) .diskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds), .eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds) .diskPersistent(diskPersistent) .diskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds) .eternal(eternal) .timeToLiveSeconds(timeToLiveSeconds) .timeToIdleSeconds(timeToIdleSeconds) .diskPersistent(diskPersistent) .diskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds)