/** * setMaxElementsInMemory * * @param maxElements * @deprecated use {@link #setMaxEntriesLocalHeap(long)} */ @Deprecated public void setMaxElementsInMemory(int maxElements) { cacheConfiguration.setMaxElementsInMemory(maxElements); }
/** * Builder that sets the maximum objects to be held in memory (0 = no limit). * <p> * This property can be modified dynamically while the cache is operating. * * @param maxElementsInMemory The maximum number of elements in memory, before they are evicted (0 == no limit) * @return this configuration instance * @deprecated use {@link #maxEntriesLocalHeap(int)} */ @Deprecated public final CacheConfiguration maxElementsInMemory(int maxElementsInMemory) { setMaxElementsInMemory(maxElementsInMemory); return this; }
/** * {@inheritDoc} */ public void setRegionCacheTargetMaxInMemoryCount(String region, int targetMaxInMemoryCount) { Cache cache = this.cacheManager.getCache(region); if (cache != null) { cache.getCacheConfiguration().setMaxElementsInMemory(targetMaxInMemoryCount); sendNotification(CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region); } }
/** * {@inheritDoc} */ public void setMaxElementsInMemory(int maxElements) { if (getMaxElementsInMemory() != maxElements) { try { sampledCacheDelegate.getCache().getCacheConfiguration().setMaxElementsInMemory(maxElements); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } }
/** * setMaxElementsInMemory * * @param maxElements * @deprecated use {@link #setMaxEntriesLocalHeap(long)} */ @Deprecated public void setMaxElementsInMemory(int maxElements) { cacheConfiguration.setMaxElementsInMemory(maxElements); }
/** * Builder that sets the maximum objects to be held in memory (0 = no limit). * <p/> * This property can be modified dynamically while the cache is operating. * * @param maxElementsInMemory The maximum number of elements in memory, before they are evicted (0 == no limit) * @return this configuration instance * @deprecated use {@link #maxEntriesLocalHeap(int)} */ @Deprecated public final CacheConfiguration maxElementsInMemory(int maxElementsInMemory) { setMaxElementsInMemory(maxElementsInMemory); return this; }
/** * setMaxElementsInMemory * * @param maxElements * @deprecated use {@link #setMaxEntriesLocalHeap(long)} */ @Deprecated public void setMaxElementsInMemory(int maxElements) { cacheConfiguration.setMaxElementsInMemory(maxElements); }
/** * setMaxElementsInMemory * * @param maxElements * @deprecated use {@link #setMaxEntriesLocalHeap(long)} */ @Deprecated public void setMaxElementsInMemory(int maxElements) { cacheConfiguration.setMaxElementsInMemory(maxElements); }
/** * Builder that sets the maximum objects to be held in memory (0 = no limit). * <p> * This property can be modified dynamically while the cache is operating. * * @param maxElementsInMemory The maximum number of elements in memory, before they are evicted (0 == no limit) * @return this configuration instance * @deprecated use {@link #maxEntriesLocalHeap(int)} */ @Deprecated public final CacheConfiguration maxElementsInMemory(int maxElementsInMemory) { setMaxElementsInMemory(maxElementsInMemory); return this; }
/** * Builder that sets the maximum objects to be held in memory (0 = no limit). * <p/> * This property can be modified dynamically while the cache is operating. * * @param maxElementsInMemory The maximum number of elements in memory, before they are evicted (0 == no limit) * @return this configuration instance * @deprecated use {@link #maxEntriesLocalHeap(int)} */ @Deprecated public final CacheConfiguration maxElementsInMemory(int maxElementsInMemory) { setMaxElementsInMemory(maxElementsInMemory); return this; }
/** * {@inheritDoc} */ public void setRegionCacheTargetMaxInMemoryCount(String region, int targetMaxInMemoryCount) { Cache cache = this.cacheManager.getCache(region); if (cache != null) { cache.getCacheConfiguration().setMaxElementsInMemory(targetMaxInMemoryCount); sendNotification(CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region); } }
/** * {@inheritDoc} */ public void setRegionCacheTargetMaxInMemoryCount(String region, int targetMaxInMemoryCount) { Cache cache = this.cacheManager.getCache(region); if (cache != null) { cache.getCacheConfiguration().setMaxElementsInMemory(targetMaxInMemoryCount); sendNotification(CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region); } }
/** * {@inheritDoc} */ public void setRegionCacheTargetMaxInMemoryCount(String region, int targetMaxInMemoryCount) { Cache cache = this.cacheManager.getCache(region); if (cache != null) { cache.getCacheConfiguration().setMaxElementsInMemory(targetMaxInMemoryCount); sendNotification(CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region); } }
public void setMaxElementsInMemory( int maxElementsInMemory ) { this.maxElementsInMemory = maxElementsInMemory; if ( this.ehcache != null ) { this.ehcache.getCacheConfiguration().setMaxElementsInMemory( this.maxElementsInMemory ); this.ehcache.getCacheConfiguration().setMaxEntriesLocalHeap( this.maxElementsInMemory ); } }
private ContentCache() { URL url = BlogService.class.getResource("/ehcache.xml"); CacheManager cacheManager = new CacheManager(url); cache = cacheManager.getCache("contentCache"); // size the cache (number of blogs * max elements in memory configured in the ehcache.xml file) // Fix: Previously the number of blogs was calculated through blogManager.getBlogs().getSize() which // caused the blog to load and access the Cache that is just now being initialized. // This lead to NPE because instance is not yet set to this instance. cache.getCacheConfiguration().setMaxElementsInMemory(cache.getCacheConfiguration().getMaxElementsInMemory() * BlogManager.getInstance().getNumberOfBlogs()); }
/** * {@inheritDoc} */ public void setMaxElementsInMemory(int maxElements) { if (getMaxElementsInMemory() != maxElements) { try { sampledCacheDelegate.getCache().getCacheConfiguration().setMaxElementsInMemory(maxElements); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } }
/** * {@inheritDoc} */ public void setMaxElementsInMemory(int maxElements) { if (getMaxElementsInMemory() != maxElements) { try { sampledCacheDelegate.getCache().getCacheConfiguration().setMaxElementsInMemory(maxElements); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } }
/** * {@inheritDoc} */ public void setMaxElementsInMemory(int maxElements) { if (getMaxElementsInMemory() != maxElements) { try { sampledCacheDelegate.getCache().getCacheConfiguration().setMaxElementsInMemory(maxElements); } catch (RuntimeException e) { throw Utils.newPlainException(e); } } }
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; }
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; }