1.7 KiB
1.7 KiB
GameCult.Caching.MessagePack
GameCult.Caching.MessagePack provides MessagePack persistence for the
attribute-first GameCult.Caching stack.
Included Types
SingleFileMessagePackBackingStoreMultiFileMessagePackBackingStoreCultDocumentMessagePackSerializationCultDocumentResolverCultRecordRefFormatter<T>
When a project declares [CultDocument] models, wire in the
GameCult.Caching.MessagePack.Generator analyzer there as well. It emits
assembly-local metadata providers for the cache registry; MessagePack itself
still handles payload serialization through the normal resolver path.
What It Does
- stores CultCache snapshots and records in MessagePack
- serializes plain attributed document payloads
- keeps explicit
CultRecordRef<T>values compact on disk/wire - preserves the cache/store split where metadata lives outside the domain model
Example Model
using GameCult.Caching;
using MessagePack;
[CultDocument("gamecult.item_data", "gamecult.item_data.v1")]
[MessagePackObject]
public sealed class ItemData
{
[Key(0)] [CultName] public string Name = string.Empty;
[Key(1)] public int Value;
}
Typical Usage
using GameCult.Caching;
using GameCult.Caching.MessagePack;
var cache = new CultCache();
var store = new MultiFileMessagePackBackingStore("Data");
cache.AddBackingStore(store);
await cache.PullAllBackingStoresAsync();
Notes
- Payload bytes are MessagePack. Store metadata and schema catalogs are also persisted through MessagePack in this package.
- The generator package now targets attributed document types instead of
DatabaseEntrysubclasses. - The raw CultNet document lane should treat these payload bytes as already blessed, not decode and re-encode them for sport.