Remote / API
foldkit-remote/persistence
foldkit-remote/persistence, an entry of its own (#378). Remote cache persistence: a snapshot of the entity store and nothing else.
Runtime state (connections' live cursors, optimistic layers, the mutation
ledger, gaps, retention roots) is never in a snapshot; it belongs to the
session that produced it.
The cache is server-derived and disposable: an incompatible, oversized, or
corrupt snapshot is discarded (and removed from a KeyValueStore) so the
planner refetches. dehydrate/hydrate are the string forms, for SSR and
any other transport; save/restore put them behind Effect's
KeyValueStore, so the backend (memory, filesystem, SQL, Web Storage) is the
application's choice.
Each row and list saved carries when it expires: when it was fetched plus
the maxAge of the calls that read it (persist). What has expired is
dropped when a snapshot is written and again when it is read, and a
snapshot past maxBytes drops what was read least recently first.
Namespaces
Functions
persistence | Keeps a domain's cache across a reload, as a wiring beside Data.wiring: the stored snapshot for key is restored (Hydrated, with what the store already holds… |
Values
REMOTE_CACHE_VERSION | Bump when the serialized shape changes; a mismatch discards the cache. |
Interfaces
ClockedOptions | dehydrate's and hydrate's options: SnapshotOptions, and the time to judge ages at. |
PersistedDomain | What persistence uses of a domain: Remote.make's value is one. |
PersistenceOptions | How persistence keeps the cache across a reload. |
PersistenceWiring | persistence's wiring, and the restore its runtime's init starts from. |
SavedBatch | The rows and lists one batch of reads reached: what is kept or dropped together. |
SavedList | A list kept across a reload: its edges, and its age. |
Snapshot | What survives a reload: the entity cache, and the connections an application declared should come back. |
SnapshotOptions | |
Snapshotted | What snapshotOf reads of a Model. |