CacheStats

class CacheStats(val hits: Long, val misses: Long, val evictions: Long, val failedLoads: Long)(source)

A reading of a cache's four counts. Stable Core.

The four are read separately, not as one atomic snapshot. A cache that cannot count something reports zero.

Parameters

hits

calls answered without starting a load: a stored entry, or a load already in flight that the call joined.

misses

calls that started a load.

evictions

stored entries the size bound removed. This is narrower than the evictions of Caffeine, Guava and Micrometer: expiry and invalidation are not counted.

failedLoads

loads that ended in a failure or an Error, counted once per load, not once per waiter.

Throws

if a count is negative; the message names the property.

Constructors

Link copied to clipboard
constructor(hits: Long, misses: Long, evictions: Long, failedLoads: Long)

Types

Link copied to clipboard
object Companion

The value of an empty cache.

Properties

Link copied to clipboard

Stored entries the size bound removed; expiry and invalidation are not counted.

Link copied to clipboard

Loads that ended in a failure or an Error, counted once per load.

Link copied to clipboard
val hits: Long

Calls answered without starting a load: a stored entry, or a load already in flight that the call joined.

Link copied to clipboard

Calls that started a load.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Two CacheStats are equal when their hits, misses, evictions and failedLoads are equal.

Link copied to clipboard
open override fun hashCode(): Int

Returns a hash code consistent with equals: it is computed from the same properties.

Link copied to clipboard
open override fun toString(): String

A diagnostic string for logs: hits, misses, evictions and failedLoads. Its format is not part of the API and may change.