LruCache<K, V> class

Simple in-memory LRU cache with optional time-to-live.

Constructors

LruCache({required int capacity, Duration? ttl})

Properties

capacity → int
final
hashCode → int
The hash code for this object.
no setterinherited
isEmpty → bool
no setter
isNotEmpty → bool
no setter
length → int
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
ttl → Duration?
final

Methods

clear() → void
contains(K key) → bool
evictExpired() → int
get(K key) → V?
Return the cached value for key, or null if missing / expired.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
putIfAbsent(K key, V ifAbsent()) → V
Insert via ifAbsent only when key is absent (or expired). An explicitly cached null value counts as present.
remove(K key) → void
set(K key, V value) → void
Insert value under key.
toString() → String
A string representation of this object.
inherited

Operators

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