DefaultCacheStats
Statistics about the performance of a Cache. Instances of this class are immutable.
Cache statistics are incremented according to the following rules:
- When a cache lookup encounters an existing cache entry
hitCountis incremented. - When a cache lookup first encounters a missing cache entry, a new entry is loaded.
- After successfully loading an entry
missCountandloadSuccessCountare incremented, and the total loading time, in nanoseconds, is added tototalLoadTime. - When an exception is thrown while loading an entry,
missCountandloadExceptionCountare incremented, and the total loading time, in nanoseconds, is added tototalLoadTime. - Cache lookups that encounter a missing cache entry that is still loading will wait for loading to complete (whether successful or not) and then increment
missCount.
- After successfully loading an entry
- When an entry is evicted from the cache,
evictionCountis incremented. - No stats are modified when a cache entry is invalidated or manually removed.
- No stats are modified by operations invoked on the asMap view of the cache.
Constructors
Functions
Link copied to clipboard
Returns the average time spent loading new values.
Link copied to clipboard
Returns the number of times an entry has been evicted.
Link copied to clipboard
Returns the number of times Cache lookup methods threw an exception while loading a new value.
Link copied to clipboard
Returns the ratio of cache loading attempts which threw exceptions.
Link copied to clipboard
Returns the number of times Cache lookup methods have successfully loaded a new value.
Link copied to clipboard
Returns a new
ICacheStats representing the difference between this ICacheStats and other.Link copied to clipboard
Returns a new
ICacheStats representing the sum of this ICacheStats and
other.Link copied to clipboard
Returns the number of times Cache lookup methods have returned either a cached or uncached value.
Link copied to clipboard
Returns the total number of nanoseconds the cache has spent loading new values.