/** * Redis Idempotency Store * * Redis-based implementation of the external idempotency store interface. * Provides persistent, distributed idempotency checking across multiple server instances. * * Features: * - Persistent storage (survives server restarts) * - Distributed support (multiple servers share same Redis) * - TTL support with automatic expiration * - High performance with Redis * - Optional dependency (graceful fallback if Redis unavailable) */ import type { StorageExternalIdempotencyStore, StorageIdempotencyRecord } from '@plyaz/types/storage'; import type { CoreRedisIdempotencyAdapterConfig } from '@plyaz/types/core'; import { Redis } from 'ioredis'; /** * Redis Idempotency Store * * @example * ```typescript * import Redis from 'ioredis'; * import { RedisIdempotencyAdapter } from '@plyaz/storage/webhooks'; * * const redis = new Redis({ * host: 'localhost', * port: 6379, * password: 'your-password', * }); * * const store = new RedisIdempotencyAdapter({ redis }); * * // Use with WebhookManager * const webhookManager = new WebhookManager(eventManager, logger, { * idempotency: { * externalStore: store, * defaultTTL: 3600000, // 1 hour in ms * } * }); * ``` */ export declare class RedisIdempotencyAdapter implements StorageExternalIdempotencyStore { private redis; private readonly keyPrefix; private readonly defaultTTL; private readonly debug; private redisOptions?; constructor(config: CoreRedisIdempotencyAdapterConfig); /** * Get or create Redis client */ private getRedis; /** * Build full Redis key with prefix */ private buildKey; /** * Check if key exists */ has(key: string): Promise; /** * Set key with TTL */ set(key: string, ttl: number, metadata?: Record): Promise; /** * Get record by key */ get(key: string): Promise; /** * Delete key */ delete(key: string): Promise; /** * Clear all keys (optional) */ clear(): Promise; /** * Close Redis connection */ close(): Promise; /** * Get Redis client (for advanced usage) */ getClient(): Redis | null; /** * Health check */ healthCheck(): Promise; }