WriteThroughCache<K, V extends Object> class
Wraps a synchronous Cache with an async loader, turning a cache miss
into a single load whose result is stored (the read-through / write-through
pattern apps re-implement around every remote fetch).
Concurrent misses for the SAME key share one in-flight load rather than each
invoking loader — a thundering-herd guard. A load that throws is NOT
cached and the error propagates to every waiter; the next call retries.
Audited: 2026-06-12 11:26 EDT
Constructors
-
WriteThroughCache(Cache<
K, V> _cache, Future<V> _loader(K key)) -
Wraps
cache, filling misses by awaitingloader. Audited: 2026-06-12 11:26 EDT
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
-
getOrLoad(
K key) → Future< V> -
Returns the cached value for
key; on a miss, loads it once via the loader, stores it, and returns it. Simultaneous misses forkeyawait the same load. Audited: 2026-06-12 11:26 EDT -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited