/**
 * File Content Cache
 *
 * Caches file contents with hash-based invalidation.
 * Key features:
 * - Content hash for change detection
 * - mtime-based quick validation
 * - Size limits to prevent memory bloat
 * - Automatic cleanup of stale entries
 *
 * This significantly reduces disk I/O for frequently accessed files.
 */
import { EventEmitter } from 'events';
export interface FileCacheEntry {
    path: string;
    content: string;
    hash: string;
    mtime: number;
    size: number;
    timestamp: number;
    expiresAt: number;
    hits: number;
    encoding: BufferEncoding;
}
export interface FileCacheConfig {
    enabled: boolean;
    ttlMs: number;
    maxEntries: number;
    maxFileSizeBytes: number;
    maxTotalSizeBytes: number;
    validateOnRead: boolean;
    watchForChanges: boolean;
}
export interface FileCacheStats {
    totalEntries: number;
    hits: number;
    misses: number;
    hitRate: number;
    bytesServed: number;
    bytesRead: number;
    totalCacheSize: number;
    evictions: number;
    invalidations: number;
}
export declare class FileContentCache extends EventEmitter {
    private cache;
    private config;
    private stats;
    private totalCacheSize;
    private cleanupInterval;
    constructor(config?: Partial<FileCacheConfig>);
    /**
     * Read file with caching
     */
    read(filePath: string, encoding?: BufferEncoding): Promise<{
        content: string;
        cached: boolean;
        hash: string;
    }>;
    /**
     * Store file in cache
     */
    private set;
    /**
     * Validate entry against current file state
     */
    private validateEntry;
    /**
     * Invalidate cache for a file
     */
    invalidate(filePath: string): boolean;
    /**
     * Invalidate entries matching pattern
     */
    invalidatePattern(pattern: RegExp): number;
    /**
     * Invalidate entries in a directory
     */
    invalidateDirectory(dirPath: string): number;
    /**
     * Check if file content has changed
     */
    hasChanged(filePath: string): Promise<boolean>;
    /**
     * Get file hash without reading full content if cached
     */
    getHash(filePath: string): string | null;
    /**
     * Preload files into cache
     */
    preload(filePaths: string[]): Promise<number>;
    /**
     * Check if entry is expired
     */
    private isExpired;
    /**
     * Evict entries if needed
     */
    private evictIfNeeded;
    /**
     * Evict least recently used entry
     */
    private evictLRU;
    /**
     * Cleanup expired entries
     */
    private cleanup;
    /**
     * Hash content
     */
    private hashContent;
    /**
     * Update hit rate
     */
    private updateHitRate;
    /**
     * Get statistics
     */
    getStats(): FileCacheStats;
    /**
     * Format statistics
     */
    formatStats(): string;
    /**
     * Clear cache
     */
    clear(): void;
    /**
     * Dispose resources
     */
    dispose(): void;
}
export declare function getFileContentCache(config?: Partial<FileCacheConfig>): FileContentCache;
export declare function resetFileContentCache(): void;
