Package org.cache2k.operation
Interface CacheStatistics
-
public interface CacheStatistics
Set 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-jmx
andcache2k-micrometer
are 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 long
getClearCallsCount()
Number ofCache.clear()
invocations.long
getClearedCount()
Number entries removed from the cache by theCache.clear()
operation.long
getEvictedCount()
An entry was evicted from the cache because of size limits.long
getEvictedOrRemovedWeight()
Accumulated number of weight evicted or removed entrieslong
getExpiredCount()
A cache entry has expired.long
getGetCount()
How often data was requested from the cache.double
getHitRate()
The percentage of cache accesses the cache delivered data.long
getInsertCount()
How many times a new entry was inserted into the cache.long
getKeyMutationCount()
Number of key mutations occurred.long
getLoadCount()
How many times a load succeeded.long
getLoadExceptionCount()
Number of exceptions thrown by theCacheLoader
.double
getMillisPerLoad()
Average number of milliseconds per load.long
getMissCount()
Counter of the event that: a client requested a data which was not present in the cache or had expired.long
getPutCount()
The total number of insert or update operations.long
getRefreshCount()
Refreshed entries counter.long
getRefreshedHitCount()
How many times there was a hit on a refreshed entry.long
getRefreshFailedCount()
Counter how many times a refresh failed, e.g.long
getRemoveCount()
Number of remove operations.long
getSuppressedLoadExceptionCount()
Number of exceptions thrown by theCacheLoader
that were ignored and the previous data value got returned.long
getTotalLoadMillis()
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 wordcontainsKey
does 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 theCacheLoader
that 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 fromrefreshedCount
andrefreshedHitCount
is 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
hashCode
of 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.
-
-