/** * Redis Utilities for NeuroLink * Helper functions for Redis storage operations */ import type { RedisClient, RedisConversationObject, RedisStorageConfig } from "../types/index.js"; /** * Get a pooled Redis connection. Multiple callers with the same host:port:db * share a single connection, reducing connection count. */ export declare function getPooledRedisClient(config: Required): Promise; /** * Release a pooled Redis connection. Only closes when refCount reaches 0. */ export declare function releasePooledRedisClient(config: Required): Promise; /** * Get stats about the connection pool */ export declare function getPoolStats(): Array<{ key: string; refCount: number; isOpen: boolean; }>; /** * Creates a Redis client with the provided configuration */ export declare function createRedisClient(config: Required): Promise; /** * Generates a Redis key for session messages */ export declare function getSessionKey(config: Required, sessionId: string, userId?: string): string; /** * Generates a Redis key for user sessions mapping */ export declare function getUserSessionsKey(config: Required, userId: string): string; /** * Serializes conversation object for Redis storage */ export declare function serializeConversation(conversation: RedisConversationObject): string; /** * Deserializes conversation object from Redis storage */ export declare function deserializeConversation(data: string | Buffer | null): RedisConversationObject | null; /** * Checks if Redis client is healthy */ export declare function isRedisHealthy(client: RedisClient): Promise; /** * Scan Redis keys matching a pattern without blocking the server * This is a non-blocking alternative to the KEYS command * * @param client Redis client * @param pattern Pattern to match keys (e.g. "prefix:*") * @param batchSize Number of keys to scan in each iteration (default: 100) * @returns Array of keys matching the pattern */ export declare function scanKeys(client: RedisClient, pattern: string, batchSize?: number): Promise; /** * Get normalized Redis configuration with defaults */ export declare function getNormalizedConfig(config: RedisStorageConfig): Required;