/** * SimpleCache - Unified caching utility with TTL and LRU support * * Supports two caching strategies: * - TTL-based: Entries expire after specified time * - LRU: Least Recently Used eviction when size limit reached * - Hybrid: Both TTL and LRU can be enabled together */ /** * Cache options */ export interface SimpleCacheOptions { /** TTL in milliseconds. Set to undefined to disable TTL. Default: 300000 (5 minutes) */ ttlMs?: number; /** Enable LRU eviction. Default: false */ enableLru?: boolean; /** Max cache size for LRU. Default: 100 */ maxSize?: number; } /** * SimpleCache - Generic cache supporting TTL and/or LRU eviction */ export declare class SimpleCache { private lruCache; private readonly ttlMs; private readonly maxSize; constructor(options?: SimpleCacheOptions); /** * Set cache entry * @param key Cache key * @param data Data to cache * @param ttlMs Optional override for TTL (if undefined, uses instance TTL) */ set(key: string, data: T, ttlMs?: number): void; /** * Get cache entry if still valid (not expired and not evicted by LRU) */ get(key: string, ignoreTTL?: boolean): T | null; /** * Check if key exists and is valid */ has(key: string): boolean; /** * Delete a specific key */ delete(key: string): boolean; keys(): string[]; }