Table of Contents

Class SmartCachePoolRegistry

Namespace
CL.MySQL2.Services
Assembly
CL.MySQL2.dll

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

Task

Get(string)

Returns the pool with the given name, or null if not registered.

public static SmartCachePool? Get(string name)

Parameters

name string

Returns

SmartCachePool

GetStats()

Diagnostic snapshot of every registered pool.

public static IReadOnlyList<SmartCachePoolStats> GetStats()

Returns

IReadOnlyList<SmartCachePoolStats>

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

tableName string

Returns

bool

RefreshNowAsync(string, CancellationToken)

Triggers an out-of-schedule refresh for the named pool.

public static Task RefreshNowAsync(string name, CancellationToken ct = default)

Parameters

name string
ct CancellationToken

Returns

Task

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)

Parameters

name string
refreshEvery TimeSpan
maxIdleFires int
warmUp Func<Task>

Returns

SmartCachePool