CacheEntry

data class CacheEntry<T>(val value: T, val timestampMillis: Long = System.currentTimeMillis(), val ttlMillis: Long? = null)

Cached value with an optional TTL measured from timestampMillis.

Expiration follows the system wall clock. A null TTL never expires; future timestamps extend the remaining lifetime. The containing cache must synchronize its own access.

Parameters

value

The cached value

timestampMillis

Creation time in milliseconds since the Unix epoch

ttlMillis

Time-to-live in milliseconds, or null for no expiration

Constructors

Link copied to clipboard
constructor(value: T, timestampMillis: Long = System.currentTimeMillis(), ttlMillis: Long? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val value: T

Functions

Link copied to clipboard

Remaining lifetime, capped at Long.MAX_VALUE, or null for no expiration.

Link copied to clipboard

Whether the TTL has elapsed. Entries without a TTL never expire.