import type { UsageSnapshot } from "./affinity.js"; export interface UsageCacheOptions { ttlMs?: number; timeoutMs?: number; now?: () => number; } export interface UsageCache { /** Current snapshot, refreshing in the background when stale. */ get(): UsageSnapshot | undefined; /** Await a fresh snapshot, bounded by `timeoutMs`. */ refresh(): Promise; } /** * Wrap a usage fetcher in a TTL cache. * * The first call returns `undefined` rather than waiting: routing proceeds * without usage data and the snapshot is ready for the next request. This keeps * the very first request of a session as fast as an unrouted one. */ export declare function createUsageCache(fetchUsage: () => Promise>, options?: UsageCacheOptions): UsageCache;