CachePolicy

How long a load's outcome is stored. ttl is for a value (Lookup.Found), missTtl for a confirmed miss (Lookup.Missing); both are measured from the load's completion. A failure is never stored. Build one with the factory CachePolicy(ttl) { missTtl = … }.

Stable Core. A ttl of Duration.ZERO coalesces loads in flight and stores nothing; Duration.INFINITE is allowed. Equality is on both durations; toString() prints both.

Types

Link copied to clipboard

Collects the optional properties of a CachePolicy. Not thread-safe; use it only inside the factory's lambda. Stable Core. Today its only property is missTtl; further optional policy properties, when they exist, are added here rather than to the factory's parameter list.

Link copied to clipboard
object Companion

The default of Builder.missTtl.

Properties

Link copied to clipboard

How long a Lookup.Missing is stored; zero stores nothing. Not negative.

Link copied to clipboard

How long a Lookup.Found is stored; zero stores nothing (loads in flight still coalesce). Not negative.

Functions

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

Two CachePolicys are equal when their ttl and missTtl 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: ttl and missTtl. Its format is not part of the API and may change.