@aaswe/codebase-ai
Version:
AI-Assisted Software Engineering (AASWE) - Rich codebase context for IDE LLMs
72 lines • 1.95 kB
TypeScript
/**
* Cache Manager
*
* Implements intelligent caching strategies for the Hybrid Storage Manager
* with support for multiple eviction policies, TTL management, and persistence.
*/
import { EventEmitter } from 'events';
import { CacheConfig, CacheMetrics } from './types';
export declare class CacheManager extends EventEmitter {
private config;
private cache;
private accessOrder;
private accessCount;
private timers;
private metricsCollectionTimer?;
private persistenceTimer?;
private metrics;
private hits;
private misses;
constructor(config: CacheConfig);
/**
* Initialize the cache manager
*/
initialize(): Promise<void>;
/**
* Get value from cache
*/
get<T = any>(key: string): Promise<T | null>;
/**
* Set value in cache
*/
set<T = any>(key: string, value: T, ttl?: number, tags?: string[]): Promise<void>;
/**
* Delete entry from cache
*/
delete(key: string): Promise<boolean>;
/**
* Clear cache entries by pattern or tags
*/
invalidate(pattern?: string, tags?: string[]): Promise<number>;
/**
* Get cache metrics
*/
getMetrics(): CacheMetrics;
/**
* Get cache statistics
*/
getStats(): Record<string, any>;
/**
* Shutdown the cache manager
*/
shutdown(): Promise<void>;
private initializeMetrics;
private setupMetricsCollection;
private setupPersistence;
private updateAccessTracking;
private isExpired;
private calculateSize;
private getTotalSize;
private evictEntries;
private evictByMemory;
private selectEvictionCandidates;
private calculateHitRate;
private calculateMissRate;
private updateMetrics;
private getOldestEntry;
private getNewestEntry;
private loadFromPersistence;
private saveToPersistence;
}
export default CacheManager;
//# sourceMappingURL=CacheManager.d.ts.map