TtlCache<K extends Object, V extends Object> class

TTL cache (expire after duration). Roadmap #195.

Implements Cache so it is swappable with the other eviction policies behind that interface.

Implemented types

Constructors

TtlCache(Duration ttl)
Creates a cache whose entries each expire ttl after being stored. Audited: 2026-06-12 11:26 EDT

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
ttl Duration
Time-to-live for each entry; expired entries return null from get. Audited: 2026-06-12 11:26 EDT
no setter

Methods

clear() → void
Removes all entries. Audited: 2026-06-12 11:26 EDT
override
get(K key) → V?
Returns the value for key if not expired, or null. Audited: 2026-06-12 11:26 EDT
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set(K key, V value) → void
Stores value under key with a fresh expiry ttl from now. Audited: 2026-06-12 11:26 EDT
override
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited