/** * In-memory cache with mtime-based invalidation. * No external dependencies. Supports TTL and file-change detection. */ /** * In-memory cache with TTL and file-mtime-based invalidation. */ export declare class MemoryCache { private store; private maxEntries; private hits; private misses; /** * Create a new MemoryCache instance. * @param maxEntries - Maximum number of entries to store before evicting. */ constructor(maxEntries?: number); /** * Get cached value. Returns null if expired, missing, or file changed. * @param key - Cache key to look up. * @param filePath - Optional file path for mtime-based invalidation. * @returns The cached value or null if not found/expired. */ get(key: string, filePath?: string): Promise; /** * Set cached value with optional file path for mtime tracking. * @param key - Cache key. * @param data - Data to cache. * @param ttl - Time-to-live in milliseconds. * @param filePath - Optional file path for mtime tracking. */ set(key: string, data: T, ttl?: number, filePath?: string): Promise; /** * Invalidate specific key or pattern. * @param keyOrPrefix - Exact key or prefix to invalidate. * @returns The number of entries invalidated. */ invalidate(keyOrPrefix: string): number; /** * Invalidate all entries related to a file path. * @param filePath - File path to match against cache keys. * @returns The number of entries invalidated. */ invalidateFile(filePath: string): number; /** * Clear all cache entries. */ clear(): void; /** * Get cache statistics. * @returns An object with size, hits, misses, and hitRate. */ stats(): { size: number; hits: number; misses: number; hitRate: string; }; } /** * Cache for tool call results, keyed by tool name and parameters. */ export declare class ToolResultCache { private store; private maxEntries; private hits; private misses; /** * Create a new ToolResultCache instance. * @param maxEntries - Maximum number of entries to store before evicting. */ constructor(maxEntries?: number); /** * Generate a deterministic cache key from tool name + params. * @param toolName - Name of the tool. * @param params - Tool parameters. * @returns A deterministic cache key string. */ private makeKey; /** * Simple FNV-1a-inspired hash for speed. * @param str - String to hash. * @returns A base-36 hash string. */ private simpleHash; /** * Get cached tool result. Returns null on miss. * @param toolName - Name of the tool. * @param params - Tool parameters. * @returns The cached result or null if not found/expired. */ get(toolName: string, params: Record): unknown | null; /** * Cache a tool result. Default TTL: 120s (tools may return stale data for file changes). * @param toolName - Name of the tool. * @param params - Tool parameters. * @param result - The result to cache. * @param ttl - Time-to-live in milliseconds. */ set(toolName: string, params: Record, result: unknown, ttl?: number): void; /** * Invalidate all cached results for a specific tool. * @param toolName - Name of the tool to invalidate. * @returns The number of entries invalidated. */ invalidateTool(toolName: string): number; /** * Invalidate all cached results that might reference a file path. * @param filePath - File path to match against cache keys. * @returns The number of entries invalidated. */ invalidateForFile(filePath: string): number; /** * Invalidate all entries. */ clear(): void; /** * Stats for analytics integration. * @returns An object with size, hits, misses, and hitRate. */ stats(): { size: number; hits: number; misses: number; hitRate: string; }; } export declare const cache: MemoryCache; export declare const toolResultCache: ToolResultCache; //# sourceMappingURL=memory-cache.d.ts.map