/** * Cache Manager - Core Caching Layer * * Main cache orchestration service that manages different caching strategies. * This will be moved to @plyaz/core when the package structure is finalized. * * @fileoverview Core caching infrastructure * @version 1.0.0 */ import type { CacheConfig, CacheManagerStats } from '@plyaz/types'; /** * Cache manager that orchestrates different caching strategies. * Provides a unified interface for caching across the application. * * @class CacheManager * * @example * ```typescript * const cache = new CacheManager({ * isEnabled: true, * ttl: 300, * strategy: 'redis', * redisConfig: { url: 'redis://localhost:6379' } * }); * * await cache.set('key', value); * const cached = await cache.get('key'); * ``` */ export declare class CacheManager { private config; private strategy; private strategyPromise; /** * Creates a new cache manager with the specified configuration. * * @param config - Cache configuration */ constructor(config: CacheConfig); /** * Gets the cache strategy, initializing it if needed. * Uses lazy initialization to support dynamic imports for Redis. */ private getStrategy; /** * Stores a value in the cache. * * @template T - Type of the value to cache * @param key - Cache key * @param value - Value to cache * @param ttl - Optional TTL override in seconds * @returns Promise that resolves when value is cached */ set(key: string, value: T, ttl?: number): Promise; /** * Retrieves a value from the cache. * * @template T - Expected type of the cached value * @param key - Cache key * @returns Promise that resolves to cached value or null if not found/expired */ get(key: string): Promise; /** * Removes a value from the cache. * * @param key - Cache key to remove * @returns Promise that resolves when value is removed */ delete(key: string): Promise; /** * Clears all cached values. * * @returns Promise that resolves when cache is cleared */ clear(): Promise; /** * Checks if a key exists in the cache. * * @param key - Cache key to check * @returns Promise that resolves to true if key exists and is not expired */ has(key: string): Promise; /** * Gets cache statistics. * * @returns Promise that resolves to cache statistics */ getStats(): Promise; /** * Creates the appropriate cache strategy based on configuration. * Uses dynamic import for Redis to avoid bundling ioredis in frontend. * * @private * @param config - Cache configuration * @returns Promise that resolves to cache strategy instance */ private createStrategy; /** * Disposes of the cache manager and cleans up resources. * * @returns Promise that resolves when cleanup is complete */ dispose(): Promise; } export { CacheKeyBuilder } from './CacheKeyBuilder'; //# sourceMappingURL=index.d.ts.map