public long size() { Cache cache = manager.getCache(ehcacheConf.getPredefinedCacheName()); return cache.getMemoryStoreSize(); }
/** * {@inheritDoc} * * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getNumberOfElementsInMemory(java.lang.String) */ public int getNumberOfElementsInMemory(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null) { return (int) cache.getMemoryStoreSize(); } else { return -1; } }
/** * @return The current size of the cache. * * Note that this does not call getSize on the underlying cache, which is very expensive. This * will not include the size of remote caches. */ public long getSize() { return cache.getMemoryStoreSize() + cache.getDiskStoreSize(); } }
/** * @return The current size of the cache. * * Note that this does not call getSize on the underlying cache, which is very expensive. This * will not include the size of remote caches. */ public long getSize() { return cache.getMemoryStoreSize() + cache.getDiskStoreSize(); } }
/** * @return The current size of the cache. * * Note that this does not call getSize on the underlying cache, which is very expensive. This * will not include the size of remote caches. */ public long getSize() { return cache.getMemoryStoreSize() + cache.getDiskStoreSize(); } }
/** * @return The current size of the cache. * * Note that this does not call getSize on the underlying cache, which is very expensive. This * will not include the size of remote caches. */ public long getSize() { return cache.getMemoryStoreSize() + cache.getDiskStoreSize(); } }
public long getElementCountInMemory() { try { return cache.getMemoryStoreSize(); } catch (net.sf.ehcache.CacheException ce) { throw new CacheException( ce ); } }
/** * @return The current size of the cache. * * Note that this does not call getSize on the underlying cache, which is very expensive. This * will not include the size of remote caches. */ public long getSize() { return cache.getMemoryStoreSize() + cache.getDiskStoreSize(); } }
public void stats() { System.out.printf(" elems added= %s%n", addElements.get()); System.out.printf(" reqs= %d%n", requests.get()); System.out.printf(" hits= %d%n", hits.get()); if (cache != null) { System.out.printf(" cache= %s%n", cache.toString()); System.out.printf(" cache.size= %d%n", cache.getSize()); System.out.printf(" cache.memorySize= %d%n", cache.getMemoryStoreSize()); Statistics stats = cache.getStatistics(); System.out.printf(" stats= %s%n", stats.toString()); } }
@Override public synchronized RasterData getRasterData() { // synchronized to prevent multiple reader.read()-calls when RasterData raster; if ( LOG.isDebugEnabled() ) { LOG.debug( "accessing: " + this.toString() ); } Element elem = cache.get( identifier ); if ( elem == null ) { raster = reader.read(); elem = new Element( identifier, raster ); cache.put( elem ); if ( LOG.isDebugEnabled() ) { LOG.debug( "cache miss: " + this.toString() + "#mem: " + cache.getMemoryStoreSize() ); } } else { raster = (RasterData) elem.getObjectValue(); if ( LOG.isDebugEnabled() ) { LOG.debug( "cache hit: " + this.toString() ); } } return raster; }
@Override public void clearCache() { LOGGER.info("clear cache " + name); enCache.removeAll(); enCache.clearStatistics(); cacheStatistics.reset(); cacheStatistics.setMemorySize(enCache.getMemoryStoreSize()); }
CacheMonitorStateImpl state = new CacheMonitorStateImpl(name); Statistics statistics = cache.getStatistics(); state.setMemoryStoreSize(cache.getMemoryStoreSize()); if (calculate)
/** * {@inheritDoc} * <p/> * Note, the {@link #getSize} method will have the same value as the size * reported by Statistics for the statistics accuracy of * {@link Statistics#STATISTICS_ACCURACY_BEST_EFFORT}. */ public Statistics getStatistics() throws IllegalStateException { int size = getSizeBasedOnAccuracy(getLiveCacheStatistics() .getStatisticsAccuracy()); return new Statistics(this, getLiveCacheStatistics() .getStatisticsAccuracy(), getLiveCacheStatistics() .getCacheHitCount(), getLiveCacheStatistics() .getOnDiskHitCount(), getLiveCacheStatistics() .getOffHeapHitCount(), getLiveCacheStatistics() .getInMemoryHitCount(), getLiveCacheStatistics() .getCacheMissCount(), getLiveCacheStatistics() .getOnDiskMissCount(), getLiveCacheStatistics() .getOffHeapMissCount(), getLiveCacheStatistics() .getInMemoryMissCount(), size, getAverageGetTime(), getLiveCacheStatistics().getEvictedCount(), getMemoryStoreSize(), getOffHeapStoreSize(), getDiskStoreSize(), getSearchesPerSecond(), getAverageSearchTime(), getLiveCacheStatistics().getWriterQueueLength()); }