/** * Generic cache interface for caching any type of data. * Implementations can use in-memory cache, LRU cache, Redis, etc. */ interface Cache { /** * Clears all cached entries. */ clear: () => Promise; /** * Deletes a cached entry. * @param key The cache key. */ delete: (key: string) => Promise; /** * Gets a cached value. * @param key The cache key. * @returns The cached value or undefined if not found or expired. */ get: (key: string) => Promise; /** * Sets a cached value. * @param key The cache key. * @param value The value to cache. * @param ttl Time-to-live in milliseconds. */ set: (key: string, value: T, ttl: number) => Promise; } /** * Options for creating an in-memory cache. */ interface InMemoryCacheOptions { /** * Maximum number of entries in the cache. * @default 500 */ max?: number; /** * Default TTL in milliseconds for entries. * @default 3600000 (1 hour) */ ttl?: number; } /** * Default in-memory cache implementation using LRU cache. */ declare class InMemoryCache> implements Cache { private readonly cache; constructor(options?: InMemoryCacheOptions); clear: () => Promise; delete: (key: string) => Promise; get: (key: string) => Promise; set: (key: string, value: T, ttl: number) => Promise; } export { Cache, InMemoryCache, InMemoryCacheOptions };