public interface CacheStats
Modifier and Type | Method and Description |
---|---|
double |
averageLoadPenalty()
Returns the average time spent loading new values.
|
long |
evictionCount()
Returns the number of times an entry has been evicted.
|
long |
hitCount()
Returns the number of times lookup methods have returned a cached value.
|
double |
hitRate()
Returns the ratio of cache requests which were hits.
|
long |
loadCount()
Returns the total number of times that lookup methods attempted to load new
values.
|
long |
loadExceptionCount()
Returns the number of times lookup methods threw an exception while loading a new
value.
|
double |
loadExceptionRate()
Returns the ratio of cache loading attempts which threw exceptions.
|
long |
loadSuccessCount()
Returns the number of times lookup methods have successfully loaded a new value.
|
CacheStats |
minus(CacheStats other)
Returns a new
ICacheStats representing the difference between this ICacheStats
and other . |
long |
missCount()
Returns the number of times lookup methods have returned an uncached (newly
loaded) value, or null.
|
double |
missRate()
Returns the ratio of cache requests which were misses.
|
CacheStats |
plus(CacheStats other)
Returns a new
ICacheStats representing the sum of this ICacheStats and other . |
long |
requestCount()
Returns the number of times lookup methods have returned either a cached or
uncached value.
|
long |
totalLoadTime()
Returns the total number of nanoseconds the cache has spent loading new values.
|
long requestCount()
hitCount + missCount
.
Note: the values of the metrics are undefined in case of overflow (though it is guaranteed not to throw an exception). If you require specific handling, we recommend implementing your own stats collector.
long hitCount()
double hitRate()
hitCount /
requestCount
, or 1.0
when requestCount == 0
. Note that hitRate +
missRate =~ 1.0
.long missCount()
double missRate()
missCount /
requestCount
, or 0.0
when requestCount == 0
. Note that hitRate +
missRate =~ 1.0
. Cache misses include all requests which weren't cache hits, including
requests which resulted in either successful or failed loading attempts, and requests which
waited for other threads to finish loading. It is thus the case that missCount >=
loadSuccessCount + loadExceptionCount
. Multiple concurrent misses for the same key will result
in a single load operation.long loadCount()
loadSuccessCount + loadExceptionCount
.
Note: the values of the metrics are undefined in case of overflow (though it is guaranteed not to throw an exception). If you require specific handling, we recommend implementing your own stats collector.
long loadSuccessCount()
missCount()
, though missCount
is
also incremented when an exception is encountered during cache loading (see loadExceptionCount()
). Multiple concurrent misses for the same key will result in a single load
operation. This may be incremented not in conjunction with missCount
if the load occurs
as a result of a refresh or if the cache loader returned more items than was requested. missCount
may also be incremented not in conjunction with this (nor loadExceptionCount()
) on calls to getIfPresent
.long loadExceptionCount()
missCount
, though missCount
is also incremented when cache loading completes successfully (see loadSuccessCount()
). Multiple concurrent misses for the same key will result in a single load
operation. This may be incremented not in conjunction with missCount
if the load occurs
as a result of a refresh or if the cache loader returned more items than was requested. missCount
may also be incremented not in conjunction with this (nor loadSuccessCount()
)
on calls to getIfPresent
.double loadExceptionRate()
loadExceptionCount / (loadSuccessCount + loadExceptionCount)
, or 0.0
when loadSuccessCount + loadExceptionCount == 0
.
Note: the values of the metrics are undefined in case of overflow (though it is guaranteed not to throw an exception). If you require specific handling, we recommend implementing your own stats collector.
long totalLoadTime()
loadSuccessCount
or loadExceptionCount
is incremented.double averageLoadPenalty()
totalLoadTime /
(loadSuccessCount + loadExceptionCount)
.
Note: the values of the metrics are undefined in case of overflow (though it is guaranteed not to throw an exception). If you require specific handling, we recommend implementing your own stats collector.
long evictionCount()
CacheStats minus(CacheStats other)
ICacheStats
representing the difference between this ICacheStats
and other
. Negative values, which aren't supported by ICacheStats
will be
rounded up to zero.CacheStats plus(CacheStats other)
ICacheStats
representing the sum of this ICacheStats
and other
.
Note: the values of the metrics are undefined in case of overflow (though it is guaranteed not to throw an exception). If you require specific handling, we recommend implementing your own stats collector.
Copyright © 2007–2025. All rights reserved.