/** * Abstract storage backend interface for cache */ export interface StorageBackend { get(key: string): Promise; set(key: string, value: T): Promise; delete(key: string): Promise; clear(): Promise; keys(): Promise; } export interface MemoryStorageOptions { /** * Maximum number of entries (default: 1000) */ maxEntries?: number; /** * Eviction policy to use when max entries reached * - 'lru': Least Recently Used (default) * - 'fifo': First In First Out */ evictionPolicy?: 'lru' | 'fifo'; } /** * In-memory storage backend with bounded size and eviction policies * Suitable for Node.js and browser environments */ export declare class MemoryStorage implements StorageBackend { private store; private accessOrder; private insertOrder; private maxEntries; private evictionPolicy; constructor(options?: MemoryStorageOptions); get(key: string): Promise; set(key: string, value: T): Promise; delete(key: string): Promise; clear(): Promise; keys(): Promise; /** * Gets current size */ size(): number; /** * Evicts one entry based on policy */ private evict; /** * Updates access order for LRU */ private updateAccessOrder; /** * Removes key from all tracking arrays */ private removeFromTracking; } /** * LocalStorage backend for browser environments * Falls back to MemoryStorage if localStorage is not available */ export declare class LocalStorageBackend implements StorageBackend { private fallback; private fallbackToMemory; private prefix; private accessTimes; private onError?; constructor(prefix?: string, options?: MemoryStorageOptions & { onError?: (error: Error, operation: string) => void; }); private isLocalStorageAvailable; private getFullKey; get(key: string): Promise; set(key: string, value: T): Promise; delete(key: string): Promise; clear(): Promise; keys(): Promise; /** * Evicts least recently used entry * @returns true if an entry was evicted */ private evictLRU; private handleQuotaExceeded; } //# sourceMappingURL=storage.d.ts.map