Make SoA cache-managed document storage

This commit is contained in:
Meta Vens 2026-06-13 01:44:05 +01:00
commit 5428870544
10 changed files with 599 additions and 787 deletions

View file

@ -686,6 +686,21 @@ namespace GameCult.Networking
return Task.FromResult(_cache.Get<T>(key));
}
/// <summary>
/// Opens a reactive POCO presentation for one distributed CultCache document.
/// </summary>
public CultManagedDocument<T> Document<T>(CultRecordKey key) where T : class
{
ThrowIfDisposed();
return new CultManagedDocument<T>(
key,
() => _cache.Get<T>(key),
async value => { await PutAsync(key, value).ConfigureAwait(false); },
WatchRecord<T>(key)
.Where(change => change.Document != null)
.Select(change => change.Document!));
}
/// <summary>
/// Adds or replaces a document at a specific key.
/// </summary>