System.out.println(testCache.getSize()); System.out.println(testCache.getStatistics().getLocalHeapSizeInBytes()); System.out.println("runtime used memory: " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024 + "M"); System.out.println(testCache.get("1") == null); System.out.println(testCache.get("2") == null); System.out.println(testCache.getSize()); System.out.println(testCache.getStatistics().getLocalHeapSizeInBytes()); System.out.println("runtime used memory: " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024 + "M"); System.out.println(testCache.get("2") == null); System.out.println(testCache.get("3") == null); System.out.println(testCache.getSize()); System.out.println(testCache.getStatistics().getLocalHeapSizeInBytes()); System.out.println("runtime used memory: " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024 + "M");
@Override public int size() { if(isAlive()) { return ehcache.getSize(); } return 0; }
/** * {@inheritDoc } */ @Override public int getCacheSize( ) { return _cache.getSize( ); }
/** * Gets the number of item currently in the cache. * * @return the number of item currently in the cache. */ @Override public int getCacheSize( ) { return ( _cache != null ) ? _cache.getSize( ) : 0; }
@Override public int size() { return delegate.getSize(); }
@Override public int size() { return delegate.getSize(); }
@Override public boolean isEmpty() { return this.cache.getSize() == 0; }
@Override public boolean isEmpty() { return delegate.getSize() == 0; }
@Override public int size() { return cache.getSize(); }
@Override public int size() { return this.cache.getSize(); }
@Override public Integer getValue() { if (cacheManager != null) { return cacheManager.getCache(CACHE_NAME).getSize(); } return 0; } });
/** * get the number of cached elements currently cached * @return */ public int getSize() { Cache cache = cacheManager.getCache(cacheName); return cache.getSize(); }
/** * @return Get metadata cache details */ @Override public Map<String, String> getDetails() { Map<String, String> details = new HashMap<>(); details.put("status", "Enabled"); for (CACHE_NAME name : CACHE_NAME.values()) { details.put(name + ".SIZE", String.valueOf(cacheManager.getCache(name.toString()).getSize())); } return details; }
public long getElementCountInMemory() { try { return cache.getSize(); } catch (net.sf.ehcache.CacheException ce) { throw new CacheException(ce); } }
/** * {@inheritDoc} */ @Override public int getSize(String scope) throws Exception { return getScopeCache(scope).getSize(); }
public int size() { int size = 0; for (String cache : cacheManager.getCacheNames()) { size += cacheManager.getCache(cache).getSize(); } return size; }
protected int ehCacheGetSize() { if (useEhCache()) { return cache.getSize(); } return 0; }
@Override public int getCacheSize(final String cacheName) throws SCacheException { if (cacheManager == null) { return 0; } final Cache cache = cacheManager.getCache(getKeyFromCacheName(cacheName)); if (cache == null) { return 0; } return cache.getSize(); }
@Override public int getCacheSize(final String cacheName) throws SCacheException { if (cacheManager == null) { return 0; } final Cache cache = cacheManager.getCache(getKeyFromCacheName(cacheName)); if (cache == null) { return 0; } return cache.getSize(); }
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()); } }