SwrCache class abstract

Storage interface for cached CacheEntry values, keyed by an arbitrary, already-normalized Object key.

Implementations must also expose a way to subscribe to changes for a given key via watch — this is the subscription mechanism the hook layer listens to in order to rebuild widgets when cached data changes.

Implementers

Constructors

SwrCache()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

delete(Object key) → void
Removes any cached entry for key, notifying active watch subscribers with null.
get<T>(Object key) → CacheEntry<T>?
Returns the current entry for key, or null if nothing has been cached for it yet.
hasWatchers(Object key) → bool
Whether key currently has at least one active watch subscriber (e.g. a mounted useSwr hook). Used to decide whether a cascade invalidation (mutate(invalidate: [...])) is worth revalidating — there's no one to notify for a key nobody is watching.
keys() → Iterable<Object>
All keys currently present in the cache.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set<T>(Object key, CacheEntry<T> entry) → void
Stores entry for key, notifying any active watch subscribers.
toString() → String
A string representation of this object.
inherited
watch<T>(Object key) → Stream<CacheEntry<T>?>
A stream of entry changes for key: emits the new entry on set and null on delete. Does not replay the current value on subscribe.

Operators

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