public GoCacheFactory(TransactionSynchronizationManager transactionSynchronizationManager, @Value("${cruise.cache.elements.limit}") int maxElementsInMemory, @Value("${cruise.cache.is.eternal}") boolean eternal) { this.transactionSynchronizationManager = transactionSynchronizationManager; cacheConfiguration = new CacheConfiguration("goCache", maxElementsInMemory) .persistence(new PersistenceConfiguration().strategy(PersistenceConfiguration.Strategy.NONE)) .eternal(eternal) .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LRU); }
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); }
diskExpiryThreadIntervalSeconds(0).// persistence(new PersistenceConfiguration().strategy(PersistenceConfiguration.Strategy.NONE)));
supportConfig = supportConfig.persistence(new PersistenceConfiguration().strategy(Strategy.NONE)); int activeSize = 2 * refreshAheadConfig.getBatchSize() * refreshAheadConfig.getNumberOfThreads(); supportConfig = supportConfig.maxEntriesLocalHeap(activeSize); supportConfig = supportConfig.persistence(new PersistenceConfiguration().strategy(Strategy.DISTRIBUTED));
private Cache createCache() { Cache eventsDeliveredCache = new Cache( new CacheConfiguration(this.proxyIdentifier, 0).memoryStoreEvictionPolicy( MemoryStoreEvictionPolicy.LRU) .eternal(true) .persistence( new PersistenceConfiguration().strategy(Strategy.LOCALTEMPSWAP)) .transactionalMode(TransactionalMode.OFF)); eventsDeliveredCache.disableDynamicFeatures(); this.cacheManager = this.getOrCreateCacheManager(super.diskStorePath); this.cacheManager.addCache(eventsDeliveredCache); return this.cacheManager.getCache(this.proxyIdentifier); }
public DefaultCacheManagerProvider() { net.sf.ehcache.config.Configuration config = new net.sf.ehcache.config.Configuration(); config.setUpdateCheck(false); CacheConfiguration tokenCacheConfiguration = new CacheConfiguration(). maxEntriesLocalHeap(DEFAULT_MAX_CACHE_ENTRIES). name("tokenCache"). persistence(new PersistenceConfiguration().strategy(Strategy.NONE)); tokenCacheConfiguration.validateConfiguration(); config.addCache(tokenCacheConfiguration ); cacheManager = CacheManager.create(config); }
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); }
supportConfig = supportConfig.persistence(new PersistenceConfiguration().strategy(Strategy.NONE)); int activeSize = 2 * refreshAheadConfig.getBatchSize() * refreshAheadConfig.getNumberOfThreads(); supportConfig = supportConfig.maxEntriesLocalHeap(activeSize); supportConfig = supportConfig.persistence(new PersistenceConfiguration().strategy(Strategy.DISTRIBUTED));
supportConfig = supportConfig.persistence(new PersistenceConfiguration().strategy(Strategy.NONE)); int activeSize = 2 * refreshAheadConfig.getBatchSize() * refreshAheadConfig.getNumberOfThreads(); supportConfig = supportConfig.maxEntriesLocalHeap(activeSize); supportConfig = supportConfig.persistence(new PersistenceConfiguration().strategy(Strategy.DISTRIBUTED));
private static CacheManager buildCache(CacheConfig config) { CacheManager manager; if (config.getConfigurationPath() != null) { manager = CacheManager.newInstance(config.getConfigurationPath()); } else { Configuration cacheConfig = new Configuration(); cacheConfig.setMaxBytesLocalDisk((long) config.getDiskCacheSize()); cacheConfig.setMaxBytesLocalHeap((long) config.getHeapSize()); CacheConfiguration defaultCacheConfiguration = new CacheConfiguration() .persistence( new PersistenceConfiguration() .strategy( PersistenceConfiguration.Strategy .LOCALTEMPSWAP)); cacheConfig.defaultCache(defaultCacheConfiguration); if (config.isUseDiskCache()) { DiskStoreConfiguration diskConfig = new DiskStoreConfiguration(); diskConfig.setPath(config.getCacheDirectory().toAbsolutePath().toString()); cacheConfig.diskStore(diskConfig); } manager = new CacheManager(cacheConfig); manager.addCache(DEFAULT_CACHE); Cache cache = manager.getCache(DEFAULT_CACHE); SelfPopulatingCache populatingCache = new SelfPopulatingCache(cache, new S3ChunkEntryFactory(config)); manager.replaceCacheWithDecoratedCache(cache, populatingCache); } return manager; }
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()); } } }
.name(name) .statistics(statisticsEnabled) .persistence(PERSISTENCE_CONFIGURATION);
public NcwmsCatalogue(NcwmsConfig config) throws IOException { super(config, new SimpleLayerNameMapper()); this.styleCatalogue = SldTemplateStyleCatalogue.getStyleCatalogue(); dynamicCacheEnabled = config.getDynamicCacheInfo().isEnabled(); if (dynamicCacheEnabled) { if (EdalCache.cacheManager.cacheExists(CACHE_NAME) == false) { NcwmsDynamicCacheInfo cacheInfo = config.getDynamicCacheInfo(); /* * Configure cache */ CacheConfiguration cacheConfig = new CacheConfiguration(CACHE_NAME, cacheInfo.getNumberOfDatasets()) .memoryStoreEvictionPolicy(EVICTION_POLICY) .persistence(new PersistenceConfiguration() .strategy(PERSISTENCE_STRATEGY)) .transactionalMode(TRANSACTIONAL_MODE); if (cacheInfo.getElementLifetimeMinutes() > 0) { cacheConfig.setTimeToLiveSeconds( (long) (cacheInfo.getElementLifetimeMinutes() * 60)); } else { cacheConfig.eternal(true); } dynamicDatasetCache = new Cache(cacheConfig); EdalCache.cacheManager.addCache(dynamicDatasetCache); } else { dynamicDatasetCache = EdalCache.cacheManager.getCache(CACHE_NAME); } } }
cacheInfo.getNumberOfDatasets()) .memoryStoreEvictionPolicy(EVICTION_POLICY) .persistence( new PersistenceConfiguration().strategy(PERSISTENCE_STRATEGY)) .transactionalMode(TRANSACTIONAL_MODE);