/** * LRU Cache implementation with TTL support * Used for caching metadata extraction results * * @example * ```typescript * import { metadataCache, stopCacheCleanup, startCacheCleanup } from './cache'; * * // For graceful server shutdown * process.on('SIGTERM', () => { * stopCacheCleanup(); * // ... other cleanup * }); * * // For testing environments * afterAll(() => { * stopCacheCleanup(); * }); * * // Custom cleanup interval (5 minutes) * stopCacheCleanup(); * startCacheCleanup(5 * 60 * 1000); * ``` */ interface CacheWeightOptions { maxWeight: number; maxEntryWeight?: number; sizeOf: (value: T) => number; } export declare class LRUCache { private cache; private maxSize; private defaultTTL; private currentWeight; private readonly weightOptions?; constructor(maxSize?: number, defaultTTL?: number, weightOptions?: CacheWeightOptions); private removeEntry; set(key: string, value: T, ttl?: number): boolean; get(key: string): T | undefined; has(key: string): boolean; delete(key: string): boolean; clear(): void; size(): number; cleanup(): number; getStats(): { size: number; maxSize: number; defaultTTL: number; currentWeight: number; maxWeight?: number; maxEntryWeight?: number; }; } import { ExtractedMetadata, GeneratedPreview } from '../types'; export declare const metadataCache: LRUCache; export declare const PREVIEW_CACHE_MAX_ENTRY_BYTES: number; export declare const PREVIEW_CACHE_MAX_BYTES: number; export declare const previewCache: LRUCache; /** * Starts automatic cache cleanup if not already running. * @param intervalMs - Cleanup interval in milliseconds (default: 10 minutes) */ export declare function startCacheCleanup(intervalMs?: number): void; /** * Stops the automatic cache cleanup interval. * Useful for graceful shutdown in applications and testing environments. */ export declare function stopCacheCleanup(): void; /** * Checks if automatic cache cleanup is currently running. * @returns true if cleanup interval is active */ export declare function isCacheCleanupRunning(): boolean; export {};