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; }
/** * Gets the number of objects in the DiskStore * @return the DiskStore size which is always a count unadjusted for duplicates or expiries */ public long getDiskStoreObjectCount() { return statistics.getLocalDiskSize(); }
/** * {@inheritDoc} * * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getNumberOfElementsOnDisk(java.lang.String) */ public int getNumberOfElementsOnDisk(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null) { return (int) cache.getStatistics().getLocalDiskSize(); } else { return -1; } }
/** * {@inheritDoc} */ @Override public long getLocalDiskSize() { try { return cache.getStatistics().getLocalDiskSize(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } }
/** * Returns the number of elements in the disk store. * * @return the number of elements in the disk store. * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE} */ @Deprecated public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return (int) getStatistics().getRemoteSize(); } else { return (int) getStatistics().getLocalDiskSize(); } }
/** * Gets the number of objects in the DiskStore * @return the DiskStore size which is always a count unadjusted for duplicates or expiries */ public long getDiskStoreObjectCount() { return statistics.getLocalDiskSize(); }
/** * Gets the number of objects in the DiskStore * @return the DiskStore size which is always a count unadjusted for duplicates or expiries */ public long getDiskStoreObjectCount() { return statistics.getLocalDiskSize(); }
/** * {@inheritDoc} * * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getNumberOfElementsOnDisk(java.lang.String) */ public int getNumberOfElementsOnDisk(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null) { return (int) cache.getStatistics().getLocalDiskSize(); } else { return -1; } }
/** * {@inheritDoc} * * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getNumberOfElementsOnDisk(java.lang.String) */ public int getNumberOfElementsOnDisk(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null) { return (int) cache.getStatistics().getLocalDiskSize(); } else { return -1; } }
/** * {@inheritDoc} */ @Override public long getLocalDiskSize() { try { return cache.getStatistics().getLocalDiskSize(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } }
/** * {@inheritDoc} */ @Override public long getLocalDiskSize() { try { return cache.getStatistics().getLocalDiskSize(); } catch (RuntimeException e) { throw Utils.newPlainException(e); } }
/** * Returns the number of elements in the disk store. * * @return the number of elements in the disk store. * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE} */ @Deprecated public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return (int) getStatistics().getRemoteSize(); } else { return (int) getStatistics().getLocalDiskSize(); } }
/** * Returns the number of elements in the disk store. * * @return the number of elements in the disk store. * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE} */ @Deprecated public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return (int) getStatistics().getRemoteSize(); } else { return (int) getStatistics().getLocalDiskSize(); } }
(Gauge<Long>) () -> cache.getStatistics().getLocalDiskSize());