LruCache<K extends Object, V extends Object> class
LRU cache (max size, pure Dart). Roadmap #194.
Optional ttl expires entries after the given duration; expired entries
are treated as missing on get. Implements Cache so it is swappable with
the other eviction policies behind that interface.
- Implemented types
-
- Cache<
K, V>
- Cache<
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- length → int
-
Current number of entries.
Audited: 2026-06-12 11:26 EDT
no setter
- maxSize → int
-
Maximum number of entries; oldest is evicted when exceeded.
Audited: 2026-06-12 11:26 EDT
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → void -
Removes all entries and resets the cache to empty.
Audited: 2026-06-12 11:26 EDT
override
-
get(
K key) → V? -
Returns the value for
key, or null; promoteskeyto most recently used. Returns null if the entry has expired (when the cache was created with a TTL). Audited: 2026-06-12 11:26 EDToverride -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
set(
K key, V value) → void -
Associates
keywithvalue; evicts oldest entry if at capacity. Audited: 2026-06-12 11:26 EDToverride -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited