/** * Memory Cache Strategy * * In-memory cache implementation for fast local caching. * This will be moved to @plyaz/core when the package structure is finalized. * * @fileoverview Memory cache strategy implementation * @version 1.0.0 */ import type { CacheStrategy, CacheEntry, CacheStats, MemoryCacheConfig } from '@plyaz/types'; /** * In-memory cache strategy implementation. * Provides fast caching for single-instance applications. * * @class MemoryCacheStrategy * @implements {CacheStrategy} * * @example * ```typescript * const cache = new MemoryCacheStrategy({ * maxEntries: 500, * cleanupInterval: 30000 * }); * * await cache.set('key', entry); * const cached = await cache.get('key'); * ``` */ export declare class MemoryCacheStrategy implements CacheStrategy { private cache; private accessOrder; private stats; private cleanupTimer?; private readonly maxSize; private readonly cleanupInterval; private readonly onEvict?; /** * Creates a new memory cache strategy. * * @param config - Memory cache configuration */ constructor(config?: MemoryCacheConfig); /** * Stores a cache entry in memory. * * @param key - Cache key * @param entry - Cache entry to store * @returns Promise that resolves when entry is stored */ set(key: string, entry: CacheEntry): Promise; /** * Retrieves a cache entry from memory. * * @param key - Cache key * @returns Promise that resolves to cache entry or null if not found */ get(key: string): Promise | null>; /** * Removes a cache entry from memory. * * @param key - Cache key to remove * @returns Promise that resolves when entry is removed */ delete(key: string): Promise; /** * Clears all cache entries from memory. * * @returns Promise that resolves when cache is cleared */ clear(): Promise; /** * Gets cache statistics. * * @returns Promise that resolves to cache statistics */ getStats(): Promise; /** * Disposes of the memory cache and cleans up resources. * * @returns Promise that resolves when cleanup is complete */ dispose(): Promise; /** * Starts the periodic cleanup of expired entries. * * @private */ private startCleanup; /** * Removes expired entries from the cache. * * @private */ private cleanupExpiredEntries; /** * Evicts the oldest entries when cache is full. * Uses LRU-like eviction by removing the oldest entries by creation time. * * @private */ private evictOldestEntries; } //# sourceMappingURL=memory.d.ts.map