import type { IContainer } from 'node-cqrs'; import type { Redis } from 'ioredis'; /** * Abstract base class for accessing a Redis instance. * * Manages the Redis client lifecycle, ensuring initialization via `assertConnection`. * Supports providing a Redis instance directly or a factory function for lazy initialization. * * Subclasses must implement the `initialize` method for specific setup tasks * (e.g. registering Lua commands with `defineCommand`). */ export declare abstract class AbstractRedisAccessor { #private; protected redis: Redis | undefined; constructor(c: Partial>); protected abstract initialize(redis: Redis): Promise | void; /** * Ensures that the Redis connection is initialized. * Uses a lock to prevent race conditions during concurrent initialization attempts. * If the client is not already set, it creates one using the provided factory * and then calls the `initialize` method. * * This method is idempotent and safe to call multiple times. */ assertConnection(): Promise; }