Make SoA cache-managed document storage
This commit is contained in:
parent
365042ba6d
commit
5428870544
10 changed files with 599 additions and 787 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in a new issue