public class LookupCacheStats extends Object
LoadingCache
. Instances of this class are immutable.
Cache statistics are incremented according to the following rules:
hitCount
is incremented.
missCount
is incremented.
evictionCount
is incremented.
Constructor and Description |
---|
LookupCacheStats(long hitCount,
long missCount,
long evictionCount)
Constructs a new
CacheStats instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
long |
evictionCount()
Returns the number of times an entry has been evicted.
|
int |
hashCode() |
long |
hitCount()
Returns the number of times
LoadingCache lookup methods have returned a cached value. |
double |
hitRate()
Returns the ratio of cache requests which were hits.
|
LookupCacheStats |
minus(LookupCacheStats other)
Returns a new
CacheStats representing the difference between this CacheStats
and other . |
long |
missCount()
Returns the number of times
LoadingCache lookup methods have returned an uncached (newly
loaded) value, or null. |
double |
missRate()
Returns the ratio of cache requests which were misses.
|
LookupCacheStats |
plus(LookupCacheStats other)
Returns a new
CacheStats representing the sum of this CacheStats
and other . |
long |
requestCount()
Returns the number of times
LoadingCache lookup methods have returned either a cached or
uncached value. |
String |
toString() |
public LookupCacheStats(long hitCount, long missCount, long evictionCount)
CacheStats
instance.public long requestCount()
LoadingCache
lookup methods have returned either a cached or
uncached value. This is defined as hitCount + missCount
.public long hitCount()
LoadingCache
lookup methods have returned a cached value.public double hitRate()
hitCount / requestCount
, or 1.0
when requestCount == 0
.
Note that hitRate + missRate =~ 1.0
.public long missCount()
LoadingCache
lookup methods have returned an uncached (newly
loaded) value, or null. Multiple concurrent calls to LoadingCache
lookup methods on an absent
value can result in multiple misses, all returning the results of a single cache load
operation.public 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.public long evictionCount()
public LookupCacheStats minus(LookupCacheStats other)
CacheStats
representing the difference between this CacheStats
and other
. Negative values, which aren't supported by CacheStats
will be
rounded up to zero.public LookupCacheStats plus(LookupCacheStats other)
CacheStats
representing the sum of this CacheStats
and other
.Copyright © 2011–2017. All rights reserved.