Make CultCache hydration subscription-shaped
This commit is contained in:
parent
54e2e69ff7
commit
085e177742
8 changed files with 554 additions and 72 deletions
|
|
@ -49,6 +49,12 @@ namespace GameCult.Caching.MessagePack
|
|||
/// </summary>
|
||||
public string? DirectoryStorePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the records to hydrate when opening a paged directory store.
|
||||
/// The directory manifest is always read; rejected record payloads are never opened.
|
||||
/// </summary>
|
||||
public Func<CultPersistedRecordMetadata, bool>? DirectoryStoreHydrationFilter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an optional callback used to customize the directory backing store before opening.
|
||||
/// </summary>
|
||||
|
|
@ -82,7 +88,8 @@ namespace GameCult.Caching.MessagePack
|
|||
{
|
||||
var directoryStore = new DirectoryMessagePackBackingStore(filePath, options.DirectoryStorePath)
|
||||
{
|
||||
FlushOnDispose = options.StoreFlushOnDispose
|
||||
FlushOnDispose = options.StoreFlushOnDispose,
|
||||
HydrationFilter = options.DirectoryStoreHydrationFilter
|
||||
};
|
||||
options.ConfigureDirectoryStore?.Invoke(directoryStore);
|
||||
cache.AddBackingStore(directoryStore);
|
||||
|
|
|
|||
Loading…
Reference in a new issue