UNPKG

datapilot-cli

Version:

Enterprise-grade streaming multi-format data analysis with comprehensive statistical insights and intelligent relationship detection - supports CSV, JSON, Excel, TSV, Parquet - memory-efficient, cross-platform

133 lines 3.21 kB
/** * Section Cache Manager - Intelligent caching of section results * Addresses GitHub issue #23: Prevent re-processing files for each section */ export interface CacheEntry<T = any> { data: T; timestamp: number; fileHash: string; fileSize: number; lastModified: number; dataSize: number; section: string; version: string; } export interface CacheStats { totalEntries: number; totalSizeBytes: number; hitRate: number; totalHits: number; totalMisses: number; oldestEntry: number; newestEntry: number; } export interface CacheConfig { enabled: boolean; maxSizeBytes: number; maxEntries: number; ttlMs: number; cacheDirectory: string; enableDiskCache: boolean; enableMemoryCache: boolean; compressionLevel: number; } export declare class SectionCacheManager { private memoryCache; private cacheStats; private config; private readonly CACHE_VERSION; constructor(config?: Partial<CacheConfig>); /** * Get cached result for a section */ get<T>(filePath: string, section: string): Promise<T | null>; /** * Set cached result for a section */ set<T>(filePath: string, section: string, data: T): Promise<void>; /** * Check if cache entry exists and is valid */ has(filePath: string, section: string): Promise<boolean>; /** * Clear cache for a specific file */ clearFile(filePath: string): Promise<void>; /** * Clear all cache entries */ clearAll(): Promise<void>; /** * Get cache statistics */ getStats(): Promise<CacheStats>; /** * Enable or disable caching */ setEnabled(enabled: boolean): void; /** * Update cache configuration */ updateConfig(newConfig: Partial<CacheConfig>): void; /** * Generate cache key for file and section */ private generateCacheKey; /** * Calculate file hash for cache invalidation */ private calculateFileHash; /** * Create cache entry */ private createCacheEntry; /** * Check if cache entry is valid */ private isValidEntry; /** * Set entry in memory cache with eviction */ private setMemoryEntry; /** * Evict oldest entry from memory cache */ private evictOldestMemoryEntry; /** * Date fields that need restoration during deserialization */ private static readonly DATE_FIELDS; /** * Custom JSON reviver to restore Date objects from strings */ private static dateReviver; /** * Get entry from disk cache */ private getDiskEntry; /** * Set entry in disk cache */ private setDiskEntry; /** * Ensure cache directory exists */ private ensureCacheDirectory; /** * Clean up expired entries and enforce size limits */ private cleanup; /** * Remove expired entries */ private cleanupExpiredEntries; /** * Enforce cache size limits */ private enforceSizeLimit; /** * Format bytes for display */ private formatBytes; } //# sourceMappingURL=section-cache-manager.d.ts.map