ccache = ((ConfigObject) value).toConfig(); ehconfig.addCache(new CacheConfigurationBuilder(cname).build(ccache.withFallback(defcache)));
/** * Builder to add a new cache through its config * * @return this configuration instance * @throws ObjectExistsException * if a cache with the same name already exists, or if the name conflicts with the name of the default cache */ public final Configuration cache(CacheConfiguration cacheConfiguration) throws ObjectExistsException { addCache(cacheConfiguration); return this; }
/** * Allows BeanHandler to add Cache Configurations to the configuration. */ public final void addCache(CacheConfiguration cacheConfiguration) throws ObjectExistsException { addCache(cacheConfiguration, true); }
private void registerCacheConfiguration(final CacheManager cacheManager) { Map<String, CacheConfiguration> configMap = cacheManager.getConfiguration().getCacheConfigurations(); if (!configMap.containsKey(getName())) { cacheManager.getConfiguration().addCache(this, false); } }
/** * Allows BeanHandler to add Cache Configurations to the configuration. */ public final void addCache(CacheConfiguration cacheConfiguration) throws ObjectExistsException { addCache(cacheConfiguration, true); }
/** * Builder to add a new cache through its config * * @return this configuration instance * @throws ObjectExistsException * if a cache with the same name already exists, or if the name conflicts with the name of the default cache */ public final Configuration cache(CacheConfiguration cacheConfiguration) throws ObjectExistsException { addCache(cacheConfiguration); return this; }
/** * Builder to add a new cache through its config * * @return this configuration instance * @throws ObjectExistsException * if a cache with the same name already exists, or if the name conflicts with the name of the default cache */ public final Configuration cache(CacheConfiguration cacheConfiguration) throws ObjectExistsException { addCache(cacheConfiguration); return this; }
/** * Allows BeanHandler to add Cache Configurations to the configuration. */ public final void addCache(CacheConfiguration cacheConfiguration) throws ObjectExistsException { addCache(cacheConfiguration, true); }
/** * Builder to add a new cache through its config * * @return this configuration instance * @throws ObjectExistsException * if a cache with the same name already exists, or if the name conflicts with the name of the default cache */ public final Configuration cache(CacheConfiguration cacheConfiguration) throws ObjectExistsException { addCache(cacheConfiguration); return this; }
/** * Allows BeanHandler to add Cache Configurations to the configuration. */ public final void addCache(CacheConfiguration cacheConfiguration) throws ObjectExistsException { addCache(cacheConfiguration, true); }
private void registerCacheConfiguration(final CacheManager cacheManager) { Map<String, CacheConfiguration> configMap = cacheManager.getConfiguration().getCacheConfigurations(); if (!configMap.containsKey(getName())) { cacheManager.getConfiguration().addCache(this, false); } }
private void registerCacheConfiguration(final CacheManager cacheManager) { Map<String, CacheConfiguration> configMap = cacheManager.getConfiguration().getCacheConfigurations(); if (!configMap.containsKey(getName())) { cacheManager.getConfiguration().addCache(this, false); } }
private void registerCacheConfiguration(final CacheManager cacheManager) { Map<String, CacheConfiguration> configMap = cacheManager.getConfiguration().getCacheConfigurations(); if (!configMap.containsKey(getName())) { cacheManager.getConfiguration().addCache(this, false); } }
@Bean(destroyMethod = "shutdown") public net.sf.ehcache.CacheManager ehCacheManager() { CacheConfiguration cacheConfiguration = new CacheConfiguration(); cacheConfiguration.setName("restApiAuthTokenCache"); cacheConfiguration.setMemoryStoreEvictionPolicy("LRU"); cacheConfiguration.setMaxEntriesLocalHeap(0); // 0 = MAX cacheConfiguration.setTimeToLiveSeconds(14400); // 4 hours. cacheConfiguration.setEternal(false); net.sf.ehcache.config.Configuration config = new net.sf.ehcache.config.Configuration(); config.addCache(cacheConfiguration); return net.sf.ehcache.CacheManager.newInstance(config); }
@Bean public net.sf.ehcache.CacheManager ecacheManager() { CacheConfiguration allNames = new CacheConfiguration(); allNames.setName("allNames"); allNames.setMaxEntriesLocalHeap(0); allNames.setEternal(false); allNames.setTimeToIdleSeconds(1800); CacheConfiguration querySearchResult = new CacheConfiguration(); querySearchResult.setName("querySearchResult"); querySearchResult.setMaxEntriesLocalHeap(0); querySearchResult.setEternal(false); querySearchResult.setTimeToIdleSeconds(1800); CacheConfiguration names = new CacheConfiguration(); names.setName("names"); names.setMaxEntriesLocalHeap(0); names.setEternal(false); names.setTimeToIdleSeconds(1800); net.sf.ehcache.config.Configuration config = new net.sf.ehcache.config.Configuration(); config.addCache(allNames); config.addCache(querySearchResult); config.addCache(names); return net.sf.ehcache.CacheManager.newInstance(config); }
/** * Gets an EH Cache manager. * * @return the EH Cache manager. */ @Bean(destroyMethod = "shutdown") public net.sf.ehcache.CacheManager ehCacheManager() { CacheConfiguration cacheConfiguration = new CacheConfiguration(); cacheConfiguration.setName(HERD_CACHE_NAME); cacheConfiguration.setTimeToLiveSeconds(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_TIME_TO_LIVE_SECONDS, Long.class)); cacheConfiguration.setTimeToIdleSeconds(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_TIME_TO_IDLE_SECONDS, Long.class)); cacheConfiguration.setMaxElementsInMemory(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_MAX_ELEMENTS_IN_MEMORY, Integer.class)); cacheConfiguration.setMemoryStoreEvictionPolicy(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_MEMORY_STORE_EVICTION_POLICY)); net.sf.ehcache.config.Configuration config = new net.sf.ehcache.config.Configuration(); config.addCache(cacheConfiguration); return net.sf.ehcache.CacheManager.create(config); }
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); }
/** * Gets an EH Cache manager. * * @return the EH Cache manager. */ @Bean(destroyMethod = "shutdown") public net.sf.ehcache.CacheManager ehCacheManager() { CacheConfiguration cacheConfiguration = new CacheConfiguration(); cacheConfiguration.setName(HERD_CACHE_NAME); cacheConfiguration.setTimeToLiveSeconds(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_TIME_TO_LIVE_SECONDS, Long.class)); cacheConfiguration.setTimeToIdleSeconds(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_TIME_TO_IDLE_SECONDS, Long.class)); cacheConfiguration.setMaxElementsInMemory(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_MAX_ELEMENTS_IN_MEMORY, Integer.class)); cacheConfiguration.setMemoryStoreEvictionPolicy(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_MEMORY_STORE_EVICTION_POLICY)); net.sf.ehcache.config.Configuration config = new net.sf.ehcache.config.Configuration(); config.addCache(cacheConfiguration); return net.sf.ehcache.CacheManager.create(config); }
Configuration toConfiguration() { configureDiskStore(); configureDefaultCache(); for (CacheProvider<?, ?> p : caches.values()) { final String name = p.getName(); final CacheConfiguration c = newCache(name); c.setMemoryStoreEvictionPolicyFromObject(toPolicy(p.evictionPolicy())); c.setMaxElementsInMemory(getInt(name, "memorylimit", p.memoryLimit())); c.setTimeToIdleSeconds(0); c.setTimeToLiveSeconds(getSeconds(name, "maxage", p.maxAge())); c.setEternal(c.getTimeToLiveSeconds() == 0); if (p.disk() && mgr.getDiskStoreConfiguration() != null) { c.setMaxElementsOnDisk(getInt(name, "disklimit", p.diskLimit())); int v = c.getDiskSpoolBufferSizeMB() * MB; v = getInt(name, "diskbuffer", v) / MB; c.setDiskSpoolBufferSizeMB(Math.max(1, v)); c.setOverflowToDisk(c.getMaxElementsOnDisk() > 0); c.setDiskPersistent(c.getMaxElementsOnDisk() > 0); } mgr.addCache(c); } return mgr; }
Configuration toConfiguration() { configureDiskStore(); configureDefaultCache(); for (CacheProvider<?, ?> p : caches.values()) { final String name = p.getName(); final CacheConfiguration c = newCache(name); c.setMemoryStoreEvictionPolicyFromObject(toPolicy(p.evictionPolicy())); c.setMaxElementsInMemory(getInt(name, "memorylimit", p.memoryLimit())); c.setTimeToIdleSeconds(0); c.setTimeToLiveSeconds(getSeconds(name, "maxage", p.maxAge())); c.setEternal(c.getTimeToLiveSeconds() == 0); if (p.disk() && mgr.getDiskStoreConfiguration() != null) { c.setMaxElementsOnDisk(getInt(name, "disklimit", p.diskLimit())); int v = c.getDiskSpoolBufferSizeMB() * MB; v = getInt(name, "diskbuffer", v) / MB; c.setDiskSpoolBufferSizeMB(Math.max(1, v)); c.setOverflowToDisk(c.getMaxElementsOnDisk() > 0); c.setDiskPersistent(c.getMaxElementsOnDisk() > 0); } mgr.addCache(c); } return mgr; }