private String buildConfiguration(Object cache) { final StringBuilder sb = new StringBuilder(); // getCacheConfiguration() et getMaxElementsOnDisk() n'existent pas en ehcache 1.2 final CacheConfiguration config = ((Ehcache) cache).getCacheConfiguration(); sb.append("ehcache [maxElementsInMemory = ").append(config.getMaxElementsInMemory()); final boolean overflowToDisk = config.isOverflowToDisk(); sb.append(", overflowToDisk = ").append(overflowToDisk); if (overflowToDisk) { sb.append(", maxElementsOnDisk = ").append(config.getMaxElementsOnDisk()); } final boolean eternal = config.isEternal(); sb.append(", eternal = ").append(eternal); if (!eternal) { sb.append(", timeToLiveSeconds = ").append(config.getTimeToLiveSeconds()); sb.append(", timeToIdleSeconds = ").append(config.getTimeToIdleSeconds()); sb.append(", memoryStoreEvictionPolicy = ") .append(config.getMemoryStoreEvictionPolicy()); } sb.append(", diskPersistent = ").append(config.isDiskPersistent()); sb.append(']'); return sb.toString(); }
private static int calculateCorrectConcurrency(CacheConfiguration cacheConfiguration) { int maxElementOnDisk = cacheConfiguration.getMaxElementsOnDisk(); if (maxElementOnDisk <= 0 || maxElementOnDisk >= ToolkitConfigFields.DEFAULT_CONCURRENCY) { return ToolkitConfigFields.DEFAULT_CONCURRENCY; } int concurrency = 1; while (concurrency * 2 <= maxElementOnDisk) {// this while loop is not very time consuming, maximum it will do 8 // iterations concurrency *= 2; } return concurrency; }
/** * Accessor * * @deprecated use {@link #getMaxEntriesLocalDisk()} */ @Deprecated public int getMaxElementsOnDisk() { return cacheConfiguration.getMaxElementsOnDisk(); }
/** * {@inheritDoc} */ @Override public int getMaxElementsOnDisk() { return cache.getCacheConfiguration().getMaxElementsOnDisk(); }
/** * {@inheritDoc} */ public int getRegionCacheTargetMaxTotalCount(String region) { Cache cache = cacheManager.getCache(region); if (cache != null) { return cache.getCacheConfiguration().getMaxElementsOnDisk(); } else { return -1; } }
private void verifyClusteredCacheConfiguration(final Collection<ConfigError> errors) { if (!isTerracottaClustered()) { return; } if (getPinningConfiguration() != null && getPinningConfiguration().getStore() == PinningConfiguration.Store.INCACHE && getMaxElementsOnDisk() != 0) { errors.add(new CacheConfigError("maxElementsOnDisk may not be used on a pinned cache.", getName())); } if (maxEntriesLocalDiskExplicitlySet) { errors.add(new CacheConfigError("You can't set maxEntriesLocalDisk when clustering your cache with Terracotta, " + "local disks won't be used! To control elements going in the cache cluster wide, " + "use maxEntriesInCache instead", getName())); } if (maxBytesLocalDiskExplicitlySet) { errors.add(new CacheConfigError("You can't set maxBytesLocalDisk when clustering your cache with Terracotta", getName())); } if (maxElementsOnDisk != DEFAULT_MAX_ELEMENTS_ON_DISK) { errors.add(new CacheConfigError("maxElementsOnDisk is not used with clustered caches. Use maxEntriesInCache " + "to set maximum cache size.", getName())); } }
this.eventService = cache.getCacheEventNotificationService(); this.queueCapacity = cache.getCacheConfiguration().getDiskSpoolBufferSizeMB() * MEGABYTE; this.diskCapacity = cache.getCacheConfiguration().getMaxElementsOnDisk();
/** * Accessor * * @deprecated use {@link #getMaxEntriesLocalDisk()} */ @Deprecated public int getMaxElementsOnDisk() { return cacheConfiguration.getMaxElementsOnDisk(); }
/** * Accessor * * @deprecated use {@link #getMaxEntriesLocalDisk()} */ @Deprecated public int getMaxElementsOnDisk() { return cacheConfiguration.getMaxElementsOnDisk(); }
/** * Accessor * * @deprecated use {@link #getMaxEntriesLocalDisk()} */ @Deprecated public int getMaxElementsOnDisk() { return cacheConfiguration.getMaxElementsOnDisk(); }
/** * {@inheritDoc} */ public int getRegionCacheTargetMaxTotalCount(String region) { Cache cache = cacheManager.getCache(region); if (cache != null) { return cache.getCacheConfiguration().getMaxElementsOnDisk(); } else { return -1; } }
/** * {@inheritDoc} */ public int getRegionCacheTargetMaxTotalCount(String region) { Cache cache = cacheManager.getCache(region); if (cache != null) { return cache.getCacheConfiguration().getMaxElementsOnDisk(); } else { return -1; } }
/** * {@inheritDoc} */ public int getRegionCacheTargetMaxTotalCount(String region) { Cache cache = cacheManager.getCache(region); if (cache != null) { return cache.getCacheConfiguration().getMaxElementsOnDisk(); } else { return -1; } }
/** * {@inheritDoc} */ public int getMaxElementsOnDisk() { return cache.getCacheConfiguration().getMaxElementsOnDisk(); }
@Override public Object getConfigValue(Ehcache cache) { return cache.getCacheConfiguration().getMaxElementsOnDisk(); } },
/** * {@inheritDoc} */ @Override public int getMaxElementsOnDisk() { return cache.getCacheConfiguration().getMaxElementsOnDisk(); }
/** * {@inheritDoc} */ @Override public int getMaxElementsOnDisk() { return cache.getCacheConfiguration().getMaxElementsOnDisk(); }
public long getCapacity() { return cache.getCacheConfiguration().getMaxElementsInMemory() + cache.getCacheConfiguration().getMaxElementsOnDisk(); }
public int getMaxSize() { return ehcache.getCacheConfiguration().getMaxElementsInMemory()+ehcache.getCacheConfiguration().getMaxElementsOnDisk(); }
private boolean skipUpdateAccessStatistics(Element element) { return configuration.isFrozen() && element.isEternal() && (configuration.getMaxElementsInMemory() == 0) && (!configuration.isOverflowToDisk() || configuration.getMaxElementsOnDisk() == 0); }