import { OnModuleDestroy } from '@nestjs/common'; import { BaseCacheProvider } from './base-cache.provider'; /** * LRU Memory Cache Provider * * High-performance in-memory LRU (Least Recently Used) cache provider. * This is an L2 cache layer with fast access and automatic eviction. * * Features: * - O(1) get/set operations * - Automatic LRU eviction when cache is full * - Optional TTL (Time To Live) support * - Namespace isolation * - Cache statistics (size, hit rate, usage percentage) * * Use Cases: * - Session data caching * - Frequently accessed configuration * - API response caching * - Temporary data storage * * @example * ```typescript * const provider = new LRUCacheProvider({ * maxSize: 1000, * ttl: 60000, // optional TTL * namespace: 'my-cache', * }); * ``` */ export declare class LRUCacheProvider extends BaseCacheProvider implements OnModuleDestroy { private readonly logger; private cache; private namespace; private defaultTtl?; constructor(options?: { maxSize?: number; ttl?: number; namespace?: string; }); getName(): string; get(key: string): Promise; set(key: string, value: T, ttl?: number): Promise; delete(key: string | string[]): Promise; deletePattern(pattern: string): Promise; clear(): Promise; has(key: string): Promise; mget(keys: string[]): Promise<(T | null)[]>; mset(items: Array<{ key: string; value: any; }>, ttl?: number): Promise; /** * Get cache size */ getSize(): number; /** * Get cache statistics */ getStats(): { provider: string; namespace: string; size: any; maxSize: any; calculatedSize: any; usagePercentage: number; }; /** * Clean up expired items */ cleanup(): number; /** * Destroy the provider */ onModuleDestroy(): void; private getFullKey; }