Class SmartCachePoolRegistry
Process-wide registry of named SmartCachePool instances.
Pools are declared once at app startup (typically in a plugin's
OnInitializeAsync) and referenced from queries by name.
public static class SmartCachePoolRegistry
- Inheritance
-
SmartCachePoolRegistry
- Inherited Members
Methods
DisposeAllAsync()
Stops and disposes every pool. Called by the library on shutdown.
public static Task DisposeAllAsync()
Returns
Get(string)
Returns the pool with the given name, or null if not registered.
public static SmartCachePool? Get(string name)
Parameters
namestring
Returns
GetStats()
Diagnostic snapshot of every registered pool.
public static IReadOnlyList<SmartCachePoolStats> GetStats()
Returns
HasEntriesForTable(string)
Returns true if any registered pool currently has refresh entries
for the given table name. Used by Invalidate(string) to
skip mutation-triggered eviction for tables that are kept warm by a pool's
background refresh loop.
public static bool HasEntriesForTable(string tableName)
Parameters
tableNamestring
Returns
RefreshNowAsync(string, CancellationToken)
Triggers an out-of-schedule refresh for the named pool.
public static Task RefreshNowAsync(string name, CancellationToken ct = default)
Parameters
namestringctCancellationToken
Returns
Register(string, TimeSpan, int, Func<Task>?)
Registers and starts a new pool. If a pool with the same name already exists it is returned unchanged (idempotent on plugin reloads).
When warmUp is supplied the pool runs it once as
a fire-and-forget task so its hot queries are populated before the
first user request. Inside warmUp, just call the
queries that should be warm — they auto-register with the pool via
their normal .SmartCache(name) decoration. The warm-up is
skipped on a repeat registration of an existing pool.
public static SmartCachePool Register(string name, TimeSpan refreshEvery, int maxIdleFires = 10, Func<Task>? warmUp = null)