@Beta public static final class AbstractCache.SimpleStatsCounter extends Objectimplements AbstractCache .StatsCounter
AbstractCache.StatsCounter implementation for use by
Cache implementors.
| Constructor and Description |
|---|
SimpleStatsCounter()
Constructs an instance with all counts initialized to zero.
|
| Modifier and Type | Method and Description |
|---|---|
void |
incrementBy(AbstractCache
Increments all counters by the values in
other.
|
void |
recordEviction()
Records the eviction of an entry from the cache.
|
void |
recordHits(int count)
Records cache hits.
|
void |
recordLoadException(long loadTime)
Records the failed load of a new entry.
|
void |
recordLoadSuccess(long loadTime)
Records the successful load of a new entry.
|
void |
recordMisses(int count)
Records cache misses.
|
CacheStats |
snapshot()
Returns a snapshot of this counter's values.
|
public SimpleStatsCounter()
public void recordHits(int count)
AbstractCache.StatsCounter
recordHits in interface
AbstractCache.StatsCounter
count - the number of hits to record
public void recordMisses(int count)
AbstractCache.StatsCounter
Cache lookup methods with the same key on an absent value should result in a single call to either
recordLoadSuccess or
recordLoadException and multiple calls to this method, despite all being served by the results of a single load operation.
recordMisses in interface
AbstractCache.StatsCounter
count - the number of misses to record
public void recordLoadSuccess(long loadTime)
AbstractCache.StatsCounter
AbstractCache.StatsCounter.recordMisses(int) , this method should only be called by the loading thread.
recordLoadSuccess in interface
AbstractCache.StatsCounter
loadTime - the number of nanoseconds the cache spent computing or retrieving the new value
public void recordLoadException(long loadTime)
AbstractCache.StatsCounter
AbstractCache.StatsCounter.recordMisses(int) , this method should only be called by the loading thread.
recordLoadException in interface
AbstractCache.StatsCounter
loadTime - the number of nanoseconds the cache spent computing or retrieving the new value prior to an exception being thrown
public void recordEviction()
AbstractCache.StatsCounter
public CacheStatssnapshot()
AbstractCache.StatsCounter
public void incrementBy(AbstractCache.StatsCounter other)
other.