Package org.cache2k.operation
Interface CacheStatistics
-
public interface CacheStatisticsSet of metrics for cache statistics. The cache statistics can be retrieved viaCacheControl.sampleStatistics(). The statistics may be unavailable if disabled viaCache2kBuilder.disableStatistics(boolean). General information about the cache is available viaCacheInfo.For exporting to a monitoring system the modules
cache2k-jmxandcache2k-micrometerare available.Statistics are retrieved with minimum effect on the running application and avoid locks. This may lead to slight inconsistencies within the metrics, e.g. the two values
getTotalLoadMillis()andgetLoadCount()are not updated atomically.- Author:
- Jens Wilke
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longgetClearCallsCount()Number ofCache.clear()invocations.longgetClearedCount()Number entries removed from the cache by theCache.clear()operation.longgetEvictedCount()An entry was evicted from the cache because of size limits.longgetEvictedOrRemovedWeight()Accumulated number of weight evicted or removed entrieslonggetExpiredCount()A cache entry has expired.longgetGetCount()How often data was requested from the cache.doublegetHitRate()The percentage of cache accesses the cache delivered data.longgetInsertCount()How many times a new entry was inserted into the cache.longgetKeyMutationCount()Number of key mutations occurred.longgetLoadCount()How many times a load succeeded.longgetLoadExceptionCount()Number of exceptions thrown by theCacheLoader.doublegetMillisPerLoad()Average number of milliseconds per load.longgetMissCount()Counter of the event that: a client requested a data which was not present in the cache or had expired.longgetPutCount()The total number of insert or update operations.longgetRefreshCount()Refreshed entries counter.longgetRefreshedHitCount()How many times there was a hit on a refreshed entry.longgetRefreshFailedCount()Counter how many times a refresh failed, e.g.longgetRemoveCount()Number of remove operations.longgetSuppressedLoadExceptionCount()Number of exceptions thrown by theCacheLoaderthat were ignored and the previous data value got returned.longgetTotalLoadMillis()Total number of time spent loading entries from the cache loader.
-
-
-
Method Detail
-
getInsertCount
long getInsertCount()
How many times a new entry was inserted into the cache.
-
getGetCount
long getGetCount()
How often data was requested from the cache.
-
getMissCount
long getMissCount()
Counter of the event that: a client requested a data which was not present in the cache or had expired. In other wordcontainsKeydoes not count a miss.
-
getLoadCount
long getLoadCount()
How many times a load succeeded.
-
getLoadExceptionCount
long getLoadExceptionCount()
Number of exceptions thrown by theCacheLoader.
-
getSuppressedLoadExceptionCount
long getSuppressedLoadExceptionCount()
Number of exceptions thrown by theCacheLoaderthat were ignored and the previous data value got returned.
-
getMillisPerLoad
double getMillisPerLoad()
Average number of milliseconds per load.
-
getTotalLoadMillis
long getTotalLoadMillis()
Total number of time spent loading entries from the cache loader.
-
getRefreshCount
long getRefreshCount()
Refreshed entries counter.
-
getRefreshFailedCount
long getRefreshFailedCount()
Counter how many times a refresh failed, e.g. because there were not enough thread resources available.
-
getRefreshedHitCount
long getRefreshedHitCount()
How many times there was a hit on a refreshed entry. This counter is incremented once, after a refreshed entry is requested by the application for the first time. That means the quotient fromrefreshedCountandrefreshedHitCountis the efficiency of refreshing.
-
getExpiredCount
long getExpiredCount()
A cache entry has expired. The counter is incremented after the actual expiry.This can mean that the cache entry is removed or just marked as expired in case that the keep value option is enabled.
-
getEvictedCount
long getEvictedCount()
An entry was evicted from the cache because of size limits.
-
getEvictedOrRemovedWeight
long getEvictedOrRemovedWeight()
Accumulated number of weight evicted or removed entries
-
getPutCount
long getPutCount()
The total number of insert or update operations.
-
getRemoveCount
long getRemoveCount()
Number of remove operations.
-
getClearedCount
long getClearedCount()
Number entries removed from the cache by theCache.clear()operation.
-
getClearCallsCount
long getClearCallsCount()
Number ofCache.clear()invocations.
-
getKeyMutationCount
long getKeyMutationCount()
Number of key mutations occurred. This should be always 0, otherwise it is an indicator that the key object was modified after it was stored in the cache. Whenever`keyMutationCount`is non-zero, check and correct your application.How it works: When an entry is evicted the cache checks whether the
hashCodeof the key object is identical to the code when it was inserted. If not, the counter is incremented. When a mutation is detected, also a warning is logged but only once during the cache lifetime.
-
getHitRate
double getHitRate()
The percentage of cache accesses the cache delivered data.
-
-