UNPKG

docusaurus-openai-search

Version:

AI-powered search plugin for Docusaurus - extends Algolia search with intelligent keyword generation and RAG-based answers

59 lines (58 loc) 1.3 kB
interface CachedResponse { response: any; timestamp: number; queryAnalysis?: string; documents?: any[]; } /** * Simple in-memory cache for AI responses */ export declare class ResponseCache { private static instance; private cache; private logger; private readonly maxSize; private constructor(); static getInstance(): ResponseCache; /** * Reset the singleton instance (for cleanup/testing) */ static reset(): void; /** * Get cached response for a query */ getCached(query: string, ttl: number): CachedResponse | null; /** * Cache a response */ set(query: string, response: any, queryAnalysis?: string, documents?: any[]): void; /** * Clear all cached responses */ clear(): void; /** * Get cache size */ size(): number; /** * Get maximum cache size */ getMaxSize(): number; /** * Remove expired entries from cache */ cleanupExpired(ttl: number): void; /** * Get all cache keys (for debugging/monitoring) */ getKeys(): string[]; /** * Evict oldest entries when cache is full */ private evictOldest; /** * Normalize query for consistent caching */ private normalizeQuery; } export {};