public abstract class CacheStats extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CacheStats.Builder |
Constructor and Description |
---|
CacheStats() |
Modifier and Type | Method and Description |
---|---|
CacheStats |
add(CacheStats stats) |
static CacheStats.Builder |
builder() |
abstract Optional<Long> |
getEvictionCount() |
abstract Optional<Long> |
getHitCount() |
abstract Optional<Long> |
getInvalidationCount() |
abstract Optional<Long> |
getLoadExceptionCount() |
abstract Optional<Long> |
getLoadSuccessCount() |
abstract Optional<Long> |
getMissCount() |
abstract Optional<Long> |
getMissMatchCount() |
abstract Optional<Long> |
getNumberEntries() |
Optional<Long> |
getRequestCount() |
abstract Optional<Long> |
getRetrievalTime() |
abstract Optional<Long> |
getTotalLoadTime() |
abstract Optional<Long> |
getTotalMissTime() |
Optional<Double> |
hitRate()
Returns the ratio of cache requests which were hits.
|
Optional<Double> |
missMatchRate()
Returns the ratio of cache requests which were misses due to mismatch.
|
Optional<Double> |
missRate()
Returns the ratio of cache requests which were misses.
|
CacheStats |
subtract(CacheStats stats)
Adds or subtract two CacheStats if a field is specified by both CacheStats, with a minimum
value of 0.
|
public Optional<Long> getRequestCount()
getHitCount() +
getMissCount() + getMissMatchCount()
if both hitCount and one of missCount or
missMissMatchCount is setpublic Optional<Double> hitRate()
getHitCount() /
requestCount
, or 1.0
when requestCount == 0
. Note that hitRate +
missRate =~ 1.0
.public Optional<Double> missRate()
getMissCount()
/ requestCount
, or 0.0
when requestCount == 0
. Note that hitRate +
missRate + missMatchRate =~ 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 getMissCount() + getMissMatchCount() >= getLoadSuccessCount() + getLoadExceptionCount()
.
Multiple concurrent misses for the same key will result in a single load operation.public Optional<Double> missMatchRate()
getMissMatchCount() / requestCount
, or 0.0
when requestCount == 0
. Note
that hitRate + missRate + missMatchRate =~ 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 getMissCount() + getMissMatchCount() >= getLoadSuccessCount() +
getLoadExceptionCount()
. Multiple concurrent misses for the same key will result in a single
load operation.public CacheStats subtract(CacheStats stats)
stats
- the stats after the arithmetic operatorpublic CacheStats add(CacheStats stats)
public static CacheStats.Builder builder()