WriteThroughStore<K, V> class

A cache that persists every write to the backing store immediately.

Constructors

WriteThroughStore({required CacheLoader<K, V> load, required CacheStorer<K, V> store})
Creates a cache backed by load (read-through on a miss) and store (called on every put before the in-memory entry is updated). Audited: 2026-06-12 11:26 EDT

Properties

hashCode int
The hash code for this object.
no setterinherited
length int
Number of entries currently held in memory. Audited: 2026-06-12 11:26 EDT
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

get(K key) Future<V?>
Returns the cached value, loading and caching it on a miss. A backing store that returns null is treated as "absent" and is not cached. Audited: 2026-06-12 11:26 EDT
invalidate(K key) → void
Drops the in-memory entry for key without touching the backing store. Audited: 2026-06-12 11:26 EDT
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(K key, V value) Future<void>
Persists value to the store, then updates the in-memory entry. The store write is awaited first so a failed write leaves the cache unchanged. Audited: 2026-06-12 11:26 EDT
toString() String
A string representation of this object.
inherited

Operators

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