Cache<K, V> class abstract interface

The common contract shared by the in-memory caches (LruCache, TtlCache, SizeLimitCache): look up a key, store a value, clear everything.

Depending on this interface instead of a concrete class lets a call site require "a cache" without committing to an eviction policy, so LRU, TTL, or size-limited can be swapped without touching consumers. null from get always means absent-or-expired, which is why the concrete caches constrain V to a non-nullable type.

Implementers

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → void
Removes every entry. Audited: 2026-06-12 11:26 EDT
get(K key) → V?
Returns the value cached under key, or null if absent or expired. Audited: 2026-06-12 11:26 EDT
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set(K key, V value) → void
Stores value under key, applying this cache's eviction policy. Audited: 2026-06-12 11:26 EDT
toString() String
A string representation of this object.
inherited

Operators

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