import { Redis } from 'ioredis'; import { AbstractConnection } from './abstract_connection.ts'; import type { ConnectionEvents, RedisConnectionConfig, IORedisConnectionCommands } from '../types.ts'; /** * Redis connection exposes the API to run Redis commands using `ioredis` as the * underlying client. The class abstracts the need of creating and managing * multiple pub/sub connections by hand, since it handles that internally * by itself. * * @example * ```ts * const redis = new RedisConnection('main', { * host: 'localhost', * port: 6379 * }) * * await redis.set('key', 'value') * const value = await redis.get('key') * ``` */ export declare class RedisConnection extends AbstractConnection> { #private; /** * Returns the connection mode */ get mode(): "monitor" | "normal" | "subscriber"; /** * Returns the connection mode for the subscriber * connection */ get subscribeMode(): "monitor" | "normal" | "subscriber" | undefined; /** * Create a new Redis connection * * @param connectionName - Unique name for this connection * @param config - Redis connection configuration * * @example * ```ts * const connection = new RedisConnection('main', { * host: 'localhost', * port: 6379, * password: 'secret' * }) * ``` */ constructor(connectionName: string, config: RedisConnectionConfig); /** * Creates the subscriber connection, the AbstractConnection will * invoke this method when first subscription is created. */ protected makeSubscriberConnection(): void; } export interface RedisConnection extends IORedisConnectionCommands { } export default RedisConnection;