/** * Cache Manager for Virtual Filesystem * Manages local caching of MCP resources for efficient access */ /** * Cached resource metadata */ export interface CachedResource { uri: string; localPath: string; format: 'csv' | 'json' | 'parquet' | 'arrow' | 'excel' | 'unknown'; size: number; cachedAt: Date; expiresAt: Date; hits: number; metadata?: Record; } /** * Cache configuration */ export interface CacheConfig { cacheDir?: string; defaultTTL?: number; maxSize?: number; maxItems?: number; cleanupInterval?: number; } /** * Manages local caching of MCP resources */ export declare class CacheManager { private cache; private cacheDir; private config; private currentSize; private cleanupTimer?; constructor(config?: CacheConfig); /** * Initialize the cache manager */ initialize(): Promise; /** * Get cached resource path if available * @param uri The MCP URI * @returns Local file path if cached and valid, null otherwise */ getCachedPath(uri: string): Promise; /** * Cache a resource * @param uri The MCP URI * @param data The resource data * @param format The data format * @param ttl Optional TTL in milliseconds * @returns Local file path where cached */ cacheResource(uri: string, data: Buffer | string | any[], format: CachedResource['format'], ttl?: number): Promise; /** * Cache a file that's already on disk * @param uri The MCP URI * @param filePath Path to existing file * @param format The data format * @param ttl Optional TTL in milliseconds * @returns Local cache path */ cacheFile(uri: string, filePath: string, format: CachedResource['format'], ttl?: number): Promise; /** * Evict a resource from cache */ evictResource(uri: string): Promise; /** * Clear all cached resources */ clearCache(): Promise; /** * Get cache statistics */ getStats(): { itemCount: number; totalSize: number; maxSize: number; hitRate: number; oldestItem?: Date; newestItem?: Date; }; /** * Ensure there's enough space for new item */ private ensureSpace; /** * Evict least recently used item */ private evictLRU; /** * Clean up expired items */ private cleanup; /** * Start periodic cleanup timer */ private startCleanupTimer; /** * Save cache metadata to disk */ private saveCacheMetadata; /** * Load cache metadata from disk */ private loadCacheMetadata; /** * Get file extension for format */ private getExtensionForFormat; /** * Validate file extension for security */ private isValidExtension; /** * Format size for display */ private formatSize; /** * Destroy the cache manager */ destroy(): Promise; } //# sourceMappingURL=CacheManager.d.ts.map