/** * Zero-config cache handler factory * Automatically configures handlers based on type and environment variables */ import type { DataCacheHandler } from "./types.js"; export type CacheHandlerType = "memory" | "redis" | "valkey" | "elasticache"; export interface CacheHandlerOptions { /** * Cache backend type */ type: CacheHandlerType; /** * Redis/Valkey URL (e.g., "redis://localhost:6379") * @default process.env.REDIS_URL || process.env.VALKEY_URL */ url?: string; /** * ElastiCache/Redis endpoint hostname * @default process.env.ELASTICACHE_ENDPOINT */ endpoint?: string; /** * ElastiCache/Redis port * @default process.env.ELASTICACHE_PORT || 6379 */ port?: number; /** * Enable TLS/SSL * @default true for elasticache, false for redis/valkey */ tls?: boolean; /** * Auth token/password * @default process.env.ELASTICACHE_AUTH_TOKEN or process.env.REDIS_PASSWORD */ password?: string; /** * Key prefix for cache entries * @default "nextjs:cache:" */ keyPrefix?: string; /** * Key prefix for tags * @default "nextjs:tags:" */ tagPrefix?: string; /** * Enable debug logging * @default false */ debug?: boolean; /** * Max memory size (for memory handler only) * @default 100MB */ maxSize?: number; } /** * Create a cache handler with zero configuration * * @example * ```javascript * // Zero config - uses environment variables * export default createCacheHandler({ type: "redis" }); * * // With overrides * export default createCacheHandler({ * type: "elasticache", * endpoint: "my-cluster.cache.amazonaws.com", * password: process.env.AUTH_TOKEN * }); * ``` */ export declare function createCacheHandler(options: CacheHandlerOptions): DataCacheHandler; //# sourceMappingURL=factory.d.ts.map