Cache<K, V> class abstract interface

The common interface implemented by every super_cache layer: MemoryCache, SecureCache, DiskCache, and CacheOrchestrator.

All reads return FutureOr<V?> so that memory and disk implementations are interchangeable at call sites. Memory hits return a SynchronousFuture — no event-loop yield, no added latency.

Implementers

Properties

hashCode → int
The hash code for this object.
no setterinherited
metrics → CacheMetrics
A snapshot of current cache statistics.
no setter
metricsStream → Stream<CacheMetrics>
A broadcast stream that emits a fresh CacheMetrics snapshot on every internal sweep interval. Listen to this for live observability.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → FutureOr<void>
Removes all entries from this cache.
containsKey(K key) → FutureOr<bool>
Returns true if key is present and not expired.
dispose() → Future<void>
Releases all resources held by this cache: sweep timers, stream controllers, file handles, and pending writes.
get(K key) → FutureOr<V?>
Returns the cached value for key, or null if absent or expired.
getResult(K key) → FutureOr<CacheResult<V>>
Returns a CacheResult for key:
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(K key, V value, {Duration? ttl}) → FutureOr<void>
Stores value under key.
putAll(Map<K, V> entries, {Duration? ttl}) → FutureOr<void>
Stores all entries from entries.
remove(K key) → FutureOr<void>
Removes the entry for key. No-op if the key is not present.
removeWhere(bool test(K key, V value)) → FutureOr<void>
Removes all entries for which test returns true.
toString() → String
A string representation of this object.
inherited

Operators

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