Cache class Null safety

The Stash cache definition and the hub for the creation of the Cache caches

Implementers

Constructors

Cache()
The default constructor
Cache.newCache(CacheStore storage, {String? name, ExpiryPolicy? expiryPolicy, KeySampler? sampler, EvictionPolicy? evictionPolicy, int? maxEntries, CacheLoader? cacheLoader, Clock? clock, EventListenerMode? eventListenerMode})
Builds a new Cache [...]
factory
Cache.newTieredCache(Cache primary, Cache secondary)
Builds a new Tiered Cache [...]
factory

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
keys Future<Iterable<String>>
Returns a Iterable over all the Cache keys
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
size Future<int>
The number of entries on the cache
read-only

Methods

clear() Future<void>
Clears the contents of the cache
containsKey(String key) Future<bool>
Determines if the Cache contains an entry for the specified key. [...]
get(String key, {Duration? expiryDuration}) Future
Returns the cache value for the specified key. If specified expiryDuration is used instead of the configured expiry policy duration [...]
getAndPut(String key, dynamic value, {Duration? expiryDuration}) Future
Associates the specified value with the specified key in this cache, returning an existing value if one existed. If the cache previously contained a mapping for the key, the old value is replaced by the specified value [...]
getAndRemove(String key) Future
Removes the entry for a key only if currently mapped to some value. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
on<T extends CacheEvent>() Stream<T>
Listens for events of Type T and its subtypes. [...]
put(String key, dynamic value, {Duration? expiryDuration}) Future<void>
Add / Replace the cache value for the specified key. If specified expiryDuration is used instead of the configured expiry policy duration [...]
putIfAbsent(String key, dynamic value, {Duration? expiryDuration}) Future<bool>
Associates the specified key with the given value if not already associated with a value. [...]
remove(String key) Future<void>
Removes the mapping for a key from this cache if it is present. [...]
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited
operator [](String key) Future
Get the cache value for the specified key. [...]