/** * hotQueryCache.ts * * In-memory TTL cache for search results targeting the top-N repeated queries. * Phase 4 speed improvement: near-zero cost cache hits for repeated MCP searches. * * Design: * - Keyed by (userId, normalised query) — safe across multi-user Supabase deployments. * - Short TTL (default 7 s) keeps results fresh enough for interactive use. * - Capped at MAX_ENTRIES; oldest entry evicted when full. * - Warm-up queries Supabase request_events for the top-20 terms (last 7 d) * and pre-runs those searches so the first real request is already cached. */ export interface HotCacheStats { size: number; hits: number; misses: number; hitRate: number; } export declare function getHotCached(userId: string, query: string): object | null; export declare function setHotCached(userId: string, query: string, result: object): void; export declare function getHotCacheStats(): HotCacheStats; export declare function clearHotCache(): void; /** * Fetch the top-N query strings from request_events (last 7 days) and return * them so the caller can pre-warm the cache by running those searches. * * Returns an empty array when Supabase is not configured or the query fails. */ export declare function fetchTopQueries(supabaseUrl: string, serviceRoleKey: string, limit?: number): Promise; //# sourceMappingURL=hotQueryCache.d.ts.map