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 Double getValue() { return cache.getStatistics().cacheGetOperation().latency().average().value(); } });
/** * {@inheritDoc} * * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getMaxGetTimeMillis(java.lang.String) */ public long getMaxGetTimeMillis(String cacheName) { Cache cache = cacheManager.getCache(cacheName); if (cache != null) { return TimeUnit.MILLISECONDS.convert(cache.getStatistics().cacheGetOperation().latency().maximum().value().longValue(), TimeUnit.NANOSECONDS); } else { return 0; } }
/** * {@inheritDoc} * * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getMinGetTimeMillis(java.lang.String) */ public long getMinGetTimeMillis(String cacheName) { Cache cache = cacheManager.getCache(cacheName); if (cache != null) { return TimeUnit.MILLISECONDS.convert(cache.getStatistics().cacheGetOperation().latency().minimum().value().longValue(), TimeUnit.NANOSECONDS); } else { return 0; } }
/** * {@inheritDoc} * * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getAverageGetTimeMillis(java.lang.String) */ public float getAverageGetTimeMillis(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null) { return TimeUnit.MILLISECONDS.convert(cache.getStatistics().cacheGetOperation().latency().average().value().longValue(), TimeUnit.NANOSECONDS); } else { return -1f; } }
@Override public long getAverageGetTimeNanos() { return cache.getStatistics().cacheGetOperation().latency().average().value().longValue(); }
/** * {@inheritDoc} */ @Override public long getAverageGetTime() { try { return cache.getStatistics().cacheGetOperation().latency().average().value().longValue(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } }
/** * {@inheritDoc} */ @Override public SampledRateCounter getAverageGetTimeSample() { return new SampledRateCounterProxy(cache.getStatistics().cacheGetOperation().latency().average()); }
/** * {@inheritDoc} */ @Override public Long getMaxGetTimeNanos() { try { return (Long)cache.getStatistics().cacheGetOperation().latency().maximum().value(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } }
/** * {@inheritDoc} */ @Override public Long getMinGetTimeNanos() { try { return (Long)cache.getStatistics().cacheGetOperation().latency().minimum().value(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } }
@Override public float getAverageGetTime() { final float v = getEhcache().getStatistics().cacheGetOperation().latency().average().value().floatValue(); return Float.isNaN(v) ? 0f : v; }
/** * {@inheritDoc} */ @Override public long getAverageGetTime() { try { return cache.getStatistics().cacheGetOperation().latency().average().value().longValue(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } }
/** * {@inheritDoc} */ @Override public long getAverageGetTime() { try { return cache.getStatistics().cacheGetOperation().latency().average().value().longValue(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } }
/** * {@inheritDoc} */ @Override public SampledRateCounter getAverageGetTimeSample() { return new SampledRateCounterProxy(cache.getStatistics().cacheGetOperation().latency().average()); }
@Override public Double getValue() { return cache.getStatistics().cacheGetOperation().latency().average().value(); } });
/** * {@inheritDoc} */ @Override public SampledRateCounter getAverageGetTimeSample() { return new SampledRateCounterProxy(cache.getStatistics().cacheGetOperation().latency().average()); }
/** * {@inheritDoc} */ @Override public Long getMinGetTimeNanos() { try { return (Long)cache.getStatistics().cacheGetOperation().latency().minimum().value(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } }
/** * {@inheritDoc} */ @Override public Long getMaxGetTimeNanos() { try { return (Long)cache.getStatistics().cacheGetOperation().latency().maximum().value(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } }
/** * {@inheritDoc} */ @Override public Long getMaxGetTimeNanos() { try { return (Long)cache.getStatistics().cacheGetOperation().latency().maximum().value(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } }
@Override public void clear() { pCacheHits = getEhcache().getStatistics().cacheHitCount(); pCacheMisses = getEhcache().getStatistics().cacheMissCount(); pCacheGets = getEhcache().getStatistics().cacheGetOperation().count().value(); pCachePuts = getEhcache().getStatistics().cachePutCount(); pCacheRemovals = getEhcache().getStatistics().cacheRemoveCount(); pCacheEvictions = getEhcache().getStatistics().cacheEvictedCount(); }