/** * setOverflowToDisk * * @param overflowToDisk */ public void setOverflowToDisk(boolean overflowToDisk) { cacheConfiguration.setOverflowToDisk(overflowToDisk); }
/** * Builder which sets whether elements can overflow to disk when the in-memory cache has reached the set limit. * * @param overflowToDisk whether to use the disk store * @return this configuration instance * @see #setOverflowToDisk(boolean) * @deprecated The {@code overflowToDisk} attribute has been replaced with {@link Strategy#LOCALTEMPSWAP}. */ @Deprecated public final CacheConfiguration overflowToDisk(boolean overflowToDisk) { setOverflowToDisk(overflowToDisk); return this; }
/** * {@inheritDoc} */ @Override public void setOverflowToDisk(boolean overflowToDisk) { if (isOverflowToDisk() != overflowToDisk) { try { cache.getCacheConfiguration().setOverflowToDisk(overflowToDisk); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } }
/** * setOverflowToDisk * * @param overflowToDisk */ public void setOverflowToDisk(boolean overflowToDisk) { cacheConfiguration.setOverflowToDisk(overflowToDisk); }
/** * setOverflowToDisk * * @param overflowToDisk */ public void setOverflowToDisk(boolean overflowToDisk) { cacheConfiguration.setOverflowToDisk(overflowToDisk); }
/** * setOverflowToDisk * * @param overflowToDisk */ public void setOverflowToDisk(boolean overflowToDisk) { cacheConfiguration.setOverflowToDisk(overflowToDisk); }
/** * Builder which sets whether elements can overflow to disk when the in-memory cache has reached the set limit. * * @param overflowToDisk whether to use the disk store * @return this configuration instance * @see #setOverflowToDisk(boolean) * @deprecated The {@code overflowToDisk} attribute has been replaced with {@link Strategy#LOCALTEMPSWAP}. */ @Deprecated public final CacheConfiguration overflowToDisk(boolean overflowToDisk) { setOverflowToDisk(overflowToDisk); return this; }
/** * Builder which sets whether elements can overflow to disk when the in-memory cache has reached the set limit. * * @param overflowToDisk whether to use the disk store * @return this configuration instance * @see #setOverflowToDisk(boolean) * @deprecated The {@code overflowToDisk} attribute has been replaced with {@link Strategy#LOCALTEMPSWAP}. */ @Deprecated public final CacheConfiguration overflowToDisk(boolean overflowToDisk) { setOverflowToDisk(overflowToDisk); return this; }
/** * Builder which sets whether elements can overflow to disk when the in-memory cache has reached the set limit. * * @param overflowToDisk whether to use the disk store * @return this configuration instance * @see #setOverflowToDisk(boolean) * @deprecated The {@code overflowToDisk} attribute has been replaced with {@link Strategy#LOCALTEMPSWAP}. */ @Deprecated public final CacheConfiguration overflowToDisk(boolean overflowToDisk) { setOverflowToDisk(overflowToDisk); return this; }
/** * {@inheritDoc} */ public void setOverflowToDisk(boolean overflowToDisk) { if (isOverflowToDisk() != overflowToDisk) { try { cache.getCacheConfiguration().setOverflowToDisk(overflowToDisk); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } }
/** * {@inheritDoc} */ @Override public void setOverflowToDisk(boolean overflowToDisk) { if (isOverflowToDisk() != overflowToDisk) { try { cache.getCacheConfiguration().setOverflowToDisk(overflowToDisk); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } }
/** * {@inheritDoc} */ @Override public void setOverflowToDisk(boolean overflowToDisk) { if (isOverflowToDisk() != overflowToDisk) { try { cache.getCacheConfiguration().setOverflowToDisk(overflowToDisk); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } }
private void configureDefaultCache() { final CacheConfiguration c = new CacheConfiguration(); c.setMaxElementsInMemory(1024); c.setMemoryStoreEvictionPolicyFromObject(MemoryStoreEvictionPolicy.LFU); c.setTimeToIdleSeconds(0); c.setTimeToLiveSeconds(0 /* infinite */); c.setEternal(true); if (mgr.getDiskStoreConfiguration() != null) { c.setMaxElementsOnDisk(16384); c.setOverflowToDisk(false); c.setDiskPersistent(false); c.setDiskSpoolBufferSizeMB(5); c.setDiskExpiryThreadIntervalSeconds(60 * 60); } mgr.setDefaultCacheConfiguration(c); }
private CacheManager getCacheManager() { if (manager == null) { Configuration config = new Configuration(); CacheConfiguration cacheconfig = new CacheConfiguration(getName(), maxElementsInMemory); cacheconfig.setDiskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds); cacheconfig.setDiskPersistent(diskPersistent); cacheconfig.setEternal(eternal); cacheconfig.setMaxElementsOnDisk(maxElementsOnDisk); cacheconfig.setMemoryStoreEvictionPolicyFromObject(memoryStoreEvictionPolicy); cacheconfig.setOverflowToDisk(overflowToDisk); cacheconfig.setTimeToIdleSeconds(timeToIdleSeconds); cacheconfig.setTimeToLiveSeconds(timeToLiveSeconds); DiskStoreConfiguration diskStoreConfigurationParameter = new DiskStoreConfiguration(); diskStoreConfigurationParameter.setPath(getPath().getAbsolutePath()); config.addDiskStore(diskStoreConfigurationParameter); config.setDefaultCacheConfiguration(cacheconfig); manager = new CacheManager(config); } return manager; }
private CacheManager getCacheManager() { if (manager == null) { Configuration config = new Configuration(); CacheConfiguration cacheconfig = new CacheConfiguration(getName(), maxElementsInMemory); cacheconfig.setDiskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds); cacheconfig.setDiskPersistent(diskPersistent); cacheconfig.setEternal(eternal); cacheconfig.setMaxElementsOnDisk(maxElementsOnDisk); cacheconfig.setMemoryStoreEvictionPolicyFromObject(memoryStoreEvictionPolicy); cacheconfig.setOverflowToDisk(overflowToDisk); cacheconfig.setTimeToIdleSeconds(timeToIdleSeconds); cacheconfig.setTimeToLiveSeconds(timeToLiveSeconds); DiskStoreConfiguration diskStoreConfigurationParameter = new DiskStoreConfiguration(); diskStoreConfigurationParameter.setPath(getPath().getAbsolutePath()); config.addDiskStore(diskStoreConfigurationParameter); config.setDefaultCacheConfiguration(cacheconfig); manager = new CacheManager(config); } return manager; }
private void configureDefaultCache() { final CacheConfiguration c = new CacheConfiguration(); c.setMaxElementsInMemory(1024); c.setMemoryStoreEvictionPolicyFromObject(MemoryStoreEvictionPolicy.LFU); c.setTimeToIdleSeconds(0); c.setTimeToLiveSeconds(0 /* infinite */); c.setEternal(true); if (mgr.getDiskStoreConfiguration() != null) { c.setMaxElementsOnDisk(16384); c.setOverflowToDisk(false); c.setDiskPersistent(false); c.setDiskSpoolBufferSizeMB(5); c.setDiskExpiryThreadIntervalSeconds(60 * 60); } mgr.setDefaultCacheConfiguration(c); }
protected CacheConfiguration getEhCacheConfiguration(final org.bonitasoft.engine.cache.CacheConfiguration cacheConfig) { final CacheConfiguration ehCacheConfig = new CacheConfiguration(); ehCacheConfig.setMaxElementsInMemory(cacheConfig.getMaxElementsInMemory()); ehCacheConfig.setMaxElementsOnDisk(cacheConfig.getMaxElementsOnDisk()); ehCacheConfig.setOverflowToDisk(!cacheConfig.isInMemoryOnly()); ehCacheConfig.setEternal(cacheConfig.isEternal()); ehCacheConfig.setCopyOnRead(cacheConfig.isCopyOnRead()); ehCacheConfig.setCopyOnWrite(cacheConfig.isCopyOnWrite()); if (!cacheConfig.isEternal()) { ehCacheConfig.setTimeToLiveSeconds(cacheConfig.getTimeToLiveSeconds()); } return ehCacheConfig; }
/** * 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.setOverflowToDisk(this.overflowToDisk); config.setEternal(this.eternal); config.setTimeToLiveSeconds(this.timeToLive); config.setTimeToIdleSeconds(this.timeToIdle); config.setDiskPersistent(this.diskPersistent); 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); }
protected CacheConfiguration getEhCacheConfiguration(final org.bonitasoft.engine.cache.CacheConfiguration cacheConfig) { final CacheConfiguration ehCacheConfig = new CacheConfiguration(); ehCacheConfig.setMaxElementsInMemory(cacheConfig.getMaxElementsInMemory()); ehCacheConfig.setMaxElementsOnDisk(cacheConfig.getMaxElementsOnDisk()); ehCacheConfig.setOverflowToDisk(!cacheConfig.isInMemoryOnly()); ehCacheConfig.setEternal(cacheConfig.isEternal()); ehCacheConfig.setCopyOnRead(cacheConfig.isCopyOnRead()); ehCacheConfig.setCopyOnWrite(cacheConfig.isCopyOnWrite()); if (!cacheConfig.isEternal()) { ehCacheConfig.setTimeToLiveSeconds(cacheConfig.getTimeToLiveSeconds()); } return ehCacheConfig; }
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; }