Make CultCache hydration subscription-shaped

This commit is contained in:
Meta Vens 2026-07-20 01:48:56 +01:00
commit 085e177742
8 changed files with 554 additions and 72 deletions

View file

@ -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);