Cache for presentation by
Cache#stats. This is solely intended for consumption by Cache implementors.
| Modifier and Type | Method and Description |
|---|---|
| public static StatsCounter | Returns: an accumulator that does not record metricsReturns an accumulator that does not record any cache events. |
| public static StatsCounter | Returns: an accumulator that suppresses and logs any exception thrown by the delegatethe accumulator to delegate to statsCounter)Returns an accumulator that suppresses and logs any exception thrown by the delegate
|
| public void | recordEviction(@NonNegative int
the weight of the evicted entry weight, RemovalCause the reason for which the entry was removed cause)Records the eviction of an entry from the cache. |
| public void | |
| public void | recordLoadFailure(@NonNegative long
the number of nanoseconds the cache spent computing or retrieving the new value
prior to discovering the value doesn't exist or an exception being thrown loadTime)Records the failed load of a new entry. |
| public void | recordLoadSuccess(@NonNegative long
the number of nanoseconds the cache spent computing or retrieving the new value loadTime)Records the successful load of a new entry. |
| public void | |
| public CacheStats |
| disabledStatsCounter | back to summary |
|---|---|
| public static StatsCounter disabledStatsCounter() Returns an accumulator that does not record any cache events.
| |
| guardedStatsCounter | back to summary |
|---|---|
| public static StatsCounter guardedStatsCounter(StatsCounter statsCounter) Returns an accumulator that suppresses and logs any exception thrown by the delegate
| |
| recordEviction | back to summary |
|---|---|
| public void recordEviction(@NonNegative int weight, RemovalCause cause) Records the eviction of an entry from the cache. This should only been called when an entry is
evicted due to the cache's eviction strategy, and not as a result of manual
| |
| recordHits | back to summary |
|---|---|
| public void recordHits(@NonNegative int count) Records cache hits. This should be called when a cache request returns a cached value.
| |
| recordLoadFailure | back to summary |
|---|---|
| public void recordLoadFailure(@NonNegative long loadTime) Records the failed load of a new entry. This method should be called when a cache request
causes an entry to be loaded (such as by
| |
| recordLoadSuccess | back to summary |
|---|---|
| public void recordLoadSuccess(@NonNegative long loadTime) Records the successful load of a new entry. This method should be called when a cache request
causes an entry to be loaded (such as by
| |
| recordMisses | back to summary |
|---|---|
| public void recordMisses(@NonNegative int count) Records cache misses. This should be called when a cache request returns a value that was not
found in the cache. This method should be called by the loading thread, as well as by threads
blocking on the load. Multiple concurrent calls to
| |
| snapshot | back to summary |
|---|---|
| public CacheStats snapshot() Returns a snapshot of this counter's values. Note that this may be an inconsistent view, as it may be interleaved with update operations. 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.
| |