@Override public Long getValue() { return cache.getStatistics().cacheEvictionOperation().count().value(); } });
@Override public Double getValue() { return cache.getStatistics().cacheGetOperation().latency().average().value(); } });
@Override public Double getValue() { return cache.getStatistics().cacheSearchOperation().latency().average().value(); } });
public Map<String, Object> getCacheRuntimeInformationAsJson(Cache cache) { LinkedHashMap<String, Object> json = new LinkedHashMap<>(); StatisticsGateway statistics = cache.getStatistics(); json.put("Get Time in milliseconds", getStatisticsFrom(statistics.cacheGetOperation())); json.put("Put Time in milliseconds", getStatisticsFrom(statistics.cachePutOperation())); json.put("Remove Time in milliseconds", getStatisticsFrom(statistics.cacheRemoveOperation())); json.put("Cache Size", statistics.getSize()); LinkedHashMap<String, Long> cacheCount = new LinkedHashMap<>(); cacheCount.put("Hits", statistics.cacheHitCount()); cacheCount.put("Miss", statistics.cacheMissCount()); cacheCount.put("Expired", statistics.cacheExpiredCount()); cacheCount.put("Eviction", statistics.cacheEvictedCount()); cacheCount.put("Put", statistics.cachePutCount()); cacheCount.put("Remove", statistics.cacheRemoveCount()); json.put("Cache Counts", cacheCount); json.put("Cache Size (Disk)", statistics.getLocalDiskSize()); json.put("Cache Count (Disk)", statistics.localDiskHitCount()); return json; }
@Override public Long getValue() { return cache.getStatistics().cacheHitCount(); } });
@Override public Long getValue() { return cache.getStatistics().cacheMissCount(); } });
@Override public Long getValue() { return cache.getStatistics().getSize(); } });
@Override public Long getValue() { return cache.getLiveCacheStatistics().getLocalDiskSizeInBytes() + cache.getLiveCacheStatistics().getLocalHeapSizeInBytes() + cache.getLiveCacheStatistics().getLocalOffHeapSizeInBytes(); } });
@Override public Long getValue() { return cache.getStatistics().localHeapHitCount(); } });
@Override public Long getValue() { return cache.getStatistics().localHeapMissCount(); } });
@Override public Long getValue() { return cache.getStatistics().getLocalHeapSize(); } });
@Override public Long getValue() { return cache.getStatistics().getWriterQueueLength(); } });
@Override public long localHeapPutUpdatedCount() { return core.localHeapPut().value(PutOutcome.UPDATED); }
@Override public long localOffHeapMissCount() { return core.localOffHeapGet().value(GetOutcome.MISS); }
@Override public long localDiskHitCount() { return core.localDiskGet().value(GetOutcome.HIT); }
@Override public long localOffHeapPutAddedCount() { return core.localOffHeapPut().value(PutOutcome.ADDED); }
System.out.println(testCache.get("1") == 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.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("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 Long getValue() { return cache.getLiveCacheStatistics().getSize(); } });