LruCache<K, V> class
Generic LRU cache with size limits.
Usage:
final cache = LruCache<String, FileMetrics>(maxSize: 1000);
cache.put('file.dart', metrics);
final metrics = cache.get('file.dart'); // Moves to front
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
keys
→ Iterable<
K> -
All keys (most recent first).
no setter
- length → int
-
Current size.
no setter
- maxSize → int
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
values
→ Iterable<
V> -
All values (most recent first).
no setter
Methods
-
clear(
) → void - Clear all entries.
-
containsKey(
K key) → bool - Check if key exists without affecting LRU order.
-
get(
K key) → V? - Get a value, moving it to the front (most recently used).
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
put(
K key, V value) → void - Put a value, evicting old entries if needed.
-
putIfAbsent(
K key, V factory()) → V - Get or create a value using the factory.
-
remove(
K key) → V? - Remove a specific key.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited