MruCache<K, V> class

A fixed-capacity cache using most-recently-used eviction.

Constructors

MruCache(int capacity)
Creates a cache holding at most capacity entries. Requires capacity > 0. Audited: 2026-06-12 11:26 EDT

Properties

hashCode int
The hash code for this object.
no setterinherited
length int
Number of entries currently cached. Audited: 2026-06-12 11:26 EDT
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

frequencyOf(K key) int
Number of times key has been accessed (via get or put) while resident; 0 if never seen or since evicted. Audited: 2026-06-12 11:26 EDT
get(K key) → V?
Returns the value for key (or null), counting the access and marking the key most-recently-used.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(K key, V value) → void
Inserts or updates key with value. When the cache is full and key is new, the most-recently-used entry is evicted to make room. Audited: 2026-06-12 11:26 EDT
remove(K key) → void
Removes key and its frequency, if present. Audited: 2026-06-12 11:26 EDT
toString() String
A string representation of this object.
override

Operators

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