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 hitCount is incremented.
  • When a cache lookup first encounters a missing cache entry, a new entry is loaded.
    • After successfully loading an entry missCount and loadSuccessCount are incremented, and the total loading time, in nanoseconds, is added to totalLoadTime.
    • When an exception is thrown while loading an entry, missCount and loadExceptionCount are incremented, and the total loading time, in nanoseconds, is added to totalLoadTime.
    • 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.
  • When an entry is evicted from the cache, evictionCount is 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

Link copied to clipboard
constructor()
Constructs a new ICacheStats instance.
constructor(hitCount: Long, missCount: Long, loadSuccessCount: Long, loadExceptionCount: Long, totalLoadTime: Long, evictionCount: Long)
Constructs a new ICacheStats instance.

Functions

Link copied to clipboard
Returns the average time spent loading new values.
Link copied to clipboard
open fun equals(object: Any): Boolean
Link copied to clipboard
open fun evictionCount(): Long
Returns the number of times an entry has been evicted.
Link copied to clipboard
open fun hashCode(): Int
Link copied to clipboard
open fun hitCount(): Long
Returns the number of times Cache lookup methods have returned a cached value.
Link copied to clipboard
open fun hitRate(): Double
Returns the ratio of cache requests which were hits.
Link copied to clipboard
open fun loadCount(): Long
Returns the total number of times that Cache lookup methods attempted to load new values.
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
open fun minus(other: CacheStats): CacheStats
Returns a new ICacheStats representing the difference between this ICacheStats and other.
Link copied to clipboard
open fun missCount(): Long
Returns the number of times Cache lookup methods have returned an uncached (newly loaded) value, or null.
Link copied to clipboard
open fun missRate(): Double
Returns the ratio of cache requests which were misses.
Link copied to clipboard
open fun plus(other: CacheStats): CacheStats
Returns a new ICacheStats representing the sum of this ICacheStats and other.
Link copied to clipboard
open fun requestCount(): Long
Returns the number of times Cache lookup methods have returned either a cached or uncached value.
Link copied to clipboard
open fun toString(): String
Link copied to clipboard
open fun totalLoadTime(): Long
Returns the total number of nanoseconds the cache has spent loading new values.