SizeLimitCache<K extends Object, V extends Object> class
Cache with size limit (evict oldest). Roadmap #198.
Optional ttl expires entries after the given duration; expired entries
are treated as missing on get.
Constructors
- SizeLimitCache(int maxSize, {Duration? ttl})
-
Creates a cache holding at most
maxSizeentries (must be positive). Whenttlis set, entries expire that long after they were stored.
Properties
Methods
-
clear(
) → void - Removes all entries.
-
get(
K key) → V? -
Returns the value for
key, or null. Returns null if expired (when the cache was created with a TTL). -
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. -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited