Keep entities in an in-memory store backed by a durable binary snapshot plus a journal, so state survives a restart.
A standalone demo of SquidStd.Persistence: a Player store that loads existing state on
startup, appends every change to a journal, and captures a snapshot. Run it twice - the second run
reloads what the first saved.
- .NET 10 SDK
dotnet add package SquidStd.Persistence(andSquidStd.Persistence.MessagePackfor the binary serializer)
InitializeAsync replays the snapshot and journal from the save directory; GetStore<T, TKey>
returns the typed store for an entity registered in the PersistenceEntityRegistry.
Every UpsertAsync / RemoveAsync is appended to the journal, so the change is durable before
the next snapshot.
SaveSnapshotAsync captures the full state and trims the journal. Re-run the sample to see the
state reload.
dotnet run --project samples/SquidStd.Samples.Persistence
dotnet run --project samples/SquidStd.Samples.Persistence # reloads the saved state