/** * TTL cache for dynamically-resolved OAuth providers. * * Sits between the static provider registry and the onResolveProvider hook so * the hook (a database lookup, decryption, etc.) doesn't run on every request. * It is in-memory and per-worker-thread, and freshness is controlled solely by * the TTL: an entry is re-resolved once it expires, so a config change (disabled * provider, rotated credentials, etc.) takes effect within one TTL window. * * There is intentionally no manual eviction API. A per-thread evict would clear * only one worker's copy, leaving the others stale — a partial, confusing state. * The uniform TTL is the single, predictable convergence mechanism; tune it (or * disable the cache) rather than reaching for invalidation. * * cacheDynamicProviders values: * — cache for N seconds (use a low value for fresher config) * false — never cache; call the hook every request. Prefer this if your * onResolveProvider already caches at the lookup layer. * true — cache forever (no expiry); only safe if a resolved config never * changes for the life of the process. * (unset) — DEFAULT_DYNAMIC_PROVIDER_CACHE_TTL_SECONDS (bounded; see below) */ import type { ProviderRegistryEntry } from '../types.ts'; /** * Default TTL (seconds) when `cacheDynamicProviders` is not set. Bounded rather * than forever, so a changed backing config is picked up within the window with * no manual step. */ export declare const DEFAULT_DYNAMIC_PROVIDER_CACHE_TTL_SECONDS = 300; export declare class DynamicProviderCache { private cache; private ttlMs; constructor(ttl?: boolean | number); private static parseTTL; get(name: string): ProviderRegistryEntry | undefined; set(name: string, entry: ProviderRegistryEntry): void; clear(): void; updateTTL(ttl: boolean | number): void; get size(): number; }