/** * In-memory cache with TTL (Time To Live) and LRU (Least Recently Used) eviction * * Features: * - Configurable TTL per cache entry * - LRU eviction when max size is reached * - Type-safe generic implementation * - Cache statistics tracking (hits, misses, evictions) */ export interface CacheStats { hits: number; misses: number; evictions: number; size: number; maxSize: number; } export declare class Cache { private cache; private stats; private maxSize; private cleanupInterval; constructor(maxSize?: number, cleanupIntervalMs?: number); /** * Get a value from the cache * @param key Cache key * @returns Cached value or undefined if not found or expired */ get(key: string): T | undefined; /** * Set a value in the cache with TTL * @param key Cache key * @param value Value to cache * @param ttlMs Time to live in milliseconds (Infinity for no expiration) */ set(key: string, value: T, ttlMs: number): void; /** * Evict the least recently used entry */ private evictLRU; /** * Clear all entries from the cache */ clear(): void; /** * Destroy the cache and clean up resources * Call this when the cache is no longer needed to prevent memory leaks */ destroy(): void; /** * Get cache statistics */ getStats(): CacheStats; /** * Remove expired entries from cache */ private cleanupExpired; /** * Generate a cache key from components * @param components Parts to combine into a cache key (only primitives allowed) * @returns Cache key string * @throws {Error} If components contain objects or invalid types */ static generateKey(...components: (string | number | boolean | null | undefined)[]): string; /** * Calculate hit rate percentage */ getHitRate(): number; } //# sourceMappingURL=cache.d.ts.map