/** * Generic TTL-based LRU cache with configurable size and expiration. * Provides a reusable caching utility for embeddings, metadata, and other data. */ export interface CacheOptions { /** Maximum number of entries (default: 100) */ maxSize?: number; /** Time-to-live in milliseconds (default: 1 hour) */ ttlMs?: number; } /** * A generic LRU cache with TTL-based expiration. * * Features: * - Configurable max size with LRU eviction * - TTL-based expiration for entries * - Automatic cleanup of expired entries on access * - Thread-safe for single-threaded Node.js * * @example * ```typescript * const cache = new TTLCache({ maxSize: 50, ttlMs: 30000 }); * cache.set('key', [1, 2, 3]); * const value = cache.get('key'); // [1, 2, 3] or undefined if expired * ``` */ export declare class TTLCache { private cache; private readonly maxSize; private readonly ttlMs; constructor(options?: CacheOptions); /** * Get a value from the cache. * Returns undefined if not found or expired. * Updates access time for LRU tracking. */ get(key: string): T | undefined; /** * Set a value in the cache. * Evicts expired entries and oldest entry if at capacity. */ set(key: string, value: T): void; /** * Check if a key exists and is not expired. */ has(key: string): boolean; /** * Delete a specific key from the cache. */ delete(key: string): boolean; /** * Clear all entries from the cache. */ clear(): void; /** * Get the current number of entries (including potentially expired ones). */ get size(): number; /** * Get cache statistics. */ getStats(): { size: number; maxSize: number; ttlMs: number; }; /** * Evict all expired entries. */ private evictExpired; /** * Force cleanup of all expired entries. * Useful for periodic maintenance. */ cleanup(): number; } //# sourceMappingURL=cache.d.ts.map