/** * Redis Cache Strategy * * Redis-based cache implementation for distributed caching. * This will be moved to @plyaz/core when the package structure is finalized. * * @fileoverview Redis cache strategy implementation * @version 1.0.0 */ import type { CacheStrategy, CacheEntry, CacheStats, RedisCacheConfig } from '@plyaz/types'; /** * Redis cache strategy implementation. * Provides distributed caching for multi-instance applications. * * @class RedisCacheStrategy * @implements {CacheStrategy} * * @example * ```typescript * const cache = new RedisCacheStrategy({ * url: 'redis://localhost:6379', * keyPrefix: 'app:cache:' * }); * * await cache.set('key', entry); * const cached = await cache.get('key'); * ``` */ export declare class RedisCacheStrategy implements CacheStrategy { private config; private client; private stats; private isConnected; private readonly keyPrefix; /** * Creates a new Redis cache strategy. * * @param config - Redis cache configuration */ constructor(config: RedisCacheConfig); /** * Stores a cache entry in Redis. * * @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 Redis. * * @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 Redis. * * @param key - Cache key to remove * @returns Promise that resolves when entry is removed */ delete(key: string): Promise; /** * Clears all cache entries from Redis. * This removes all keys with the configured prefix. * * @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 Redis cache and cleans up resources. * * @returns Promise that resolves when cleanup is complete */ dispose(): Promise; /** * Ensures Redis connection is established. * * @private * @returns Promise that resolves when connected */ private ensureConnected; /** * Creates an ioredis client. * * @private * @returns Promise that resolves to ioredis client */ private createIoRedisClient; /** * Builds a Redis key with the configured prefix. * * @private * @param key - Base cache key * @returns Redis key with prefix */ private buildRedisKey; } //# sourceMappingURL=redis.d.ts.map