MemoryKachePersistence class final

An in-process, SDK-only persistence backend for typed cache entries.

Values are retained by reference and are not serialized or copied. This makes the backend suitable for process-local persistence, deterministic tests, and environments where callers intentionally own object mutation. Entries do not survive process termination.

Each stored key records the binding fingerprint and reified type used by its latest write. Reads require an exact match. A write under a new fingerprint authoritatively replaces the prior value; reusing one fingerprint for a different reified type remains an error. close is idempotent, releases all retained values, and causes every later operation other than close to fail.

Implemented types

Constructors

MemoryKachePersistence()

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

bind<T>({required String fingerprint}) KachePersistenceBinding<T>
Creates an opaque binding owned by this backend.
clear() Future<void>
Deletes every entry managed by this backend.
override
clearNamespace({required KacheNamespace namespace}) Future<void>
Deletes every entry in namespace.
override
close() Future<void>
Releases resources owned by this backend.
override
delete({required KacheKey key}) Future<void>
Deletes the persisted entry for key when present.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read<T>({required KacheKey key, required KachePersistenceBinding<T> binding}) Future<KachePersistenceRead<T>?>
Reads the entry for key, or returns null when no entry exists.
override
toString() String
A string representation of this object.
inherited
write<T>({required KacheKey key, required KachePersistenceBinding<T> binding, required KachePersistedEntry<T> entry}) Future<void>
Writes a typed entry for key using binding.
override

Operators

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