Cache<K, V> class abstract

Mixed in types
Implementers

Constructors

Cache()
Unnamed default constructor.
const
Cache.empty({required Loader<K, V> loader})
Constructs an empty or null cache, useful mostly for testing.
factory
Cache.expiry({required Loader<K, V> loader, Duration? updateExpiry, Duration? accessExpiry})
Constructs an expiry cache.
factory
Cache.fifo({required Loader<K, V> loader, int maximumSize = 100})
Constructs a First-in/First-out (FIFO) cache.
factory
Cache.lru({required Loader<K, V> loader, int maximumSize = 100})
Constructs a Least Recently Used (LRU) cache.
factory

Properties

defaultToStringPrinter ObjectPrinter
Override to configure the empty ObjectPrinter.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toStringPrinter ObjectPrinter
Override and call super to add values to the ObjectPrinter.
no setterinherited

Methods

get(K key) Future<V>
Returns the value associated with the key.
getIfPresent(K key) Future<V?>
Returns the value associated with the key, otherwise null.
invalidate(K key) Future<void>
Discards any cached value with the key.
invalidateAll() Future<void>
Discards all cached values.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reap() Future<int>
Returns the number of reaped items.
set(K key, FutureOr<V> value) Future<V>
Stores the value associated with the key.
size() Future<int>
Number of currently cached values.
toString() String
Standard toString implementation. Do not override, instead implement toStringPrinter to customize.
inherited

Operators

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