Found

class Found<out V : Any>(val value: V, val weight: Int) : Lookup<V> (source)

A value the endpoint returned, stored for the policy's ttl.

Stable Core. Equality is on value and weight. toString() prints the weight and never the value.

Parameters

value

the decoded value.

weight

how much of the cache's maxWeight the value uses: at least 1.

Throws

if weight is below 1: a weightless entry would escape any size bound.

Constructors

Link copied to clipboard
constructor(value: V, weight: Int)
constructor(value: V)

A value of weight 1.

Properties

Link copied to clipboard
val value: V

The decoded value.

Link copied to clipboard
val weight: Int

The value's weight against the cache's maxWeight; at least 1.

Functions

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

Two Founds are equal when their value and weight 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: the weight, never the value. Its format is not part of the API and may change.