superaugment
Version:
Enterprise-grade MCP server with world-class C++ analysis, robust error handling, and production-ready architecture for VS Code Augment
114 lines • 2.55 kB
TypeScript
/**
* SuperAugment File Cache System
*
* Provides intelligent caching for file operations with LRU eviction,
* memory management, and performance optimization for large codebases.
*/
/**
* Cache statistics interface
*/
export interface CacheStats {
totalEntries: number;
totalSize: number;
hitCount: number;
missCount: number;
evictionCount: number;
hitRate: number;
memoryUsage: number;
maxMemoryUsage: number;
}
/**
* Cache configuration options
*/
export interface FileCacheOptions {
maxMemoryUsage: number;
maxEntries: number;
maxFileSize: number;
ttlMs: number;
enableCompression: boolean;
enableIntegrityCheck: boolean;
}
/**
* LRU File Cache implementation with advanced features
*/
export declare class FileCache {
private cache;
private accessOrder;
private options;
private stats;
private cleanupTimer;
constructor(options?: Partial<FileCacheOptions>);
/**
* Get file content from cache or load from disk
*/
getFile(filePath: string): Promise<string>;
/**
* Load file content from disk
*/
private loadFileFromDisk;
/**
* Cache file content
*/
private cacheFile;
/**
* Ensure there's enough space in cache for new content
*/
private ensureCacheSpace;
/**
* Evict least recently used entries
*/
private evictLRU;
/**
* Update cache entry access information
*/
private updateCacheEntry;
/**
* Update access order for LRU tracking
*/
private updateAccessOrder;
/**
* Calculate content hash for integrity checking
*/
private calculateHash;
/**
* Normalize file path for consistent caching
*/
private normalizePath;
/**
* Update hit rate statistics
*/
private updateHitRate;
/**
* Start periodic cleanup timer
*/
private startCleanupTimer;
/**
* Clean up expired cache entries
*/
private cleanupExpiredEntries;
/**
* Get cache statistics
*/
getStats(): CacheStats;
/**
* Clear all cache entries
*/
clear(): void;
/**
* Check if file is cached
*/
has(filePath: string): boolean;
/**
* Remove specific file from cache
*/
invalidate(filePath: string): boolean;
/**
* Update cache options
*/
updateOptions(newOptions: Partial<FileCacheOptions>): void;
/**
* Cleanup resources
*/
cleanup(): void;
}
//# sourceMappingURL=FileCache.d.ts.map