UNPKG

redis-abstraction

Version:

A Redis client pool with abstraction to different Redis libraries.

25 lines (24 loc) 1.2 kB
import crypto from 'node:crypto'; import fs from 'node:fs'; import { IRedisClientPool } from "./i-redis-client-pool"; import { TRedisCommonCommands } from './t-redis-common-commands'; export declare class RedisClientPool<redisConnectionType extends TRedisCommonCommands> implements IRedisClientPool { private readonly redisConnectionCreator; private idlePoolSize; private readonly nodeFSModule; private readonly nodeCryptoModule; private totalConnectionCounter; private poolRedisClients; private activeRedisClients; constructor(redisConnectionCreator: () => redisConnectionType, idlePoolSize?: number, nodeFSModule?: typeof fs, nodeCryptoModule?: typeof crypto); initialize(): Promise<void>; acquire(token: string): Promise<void>; release(token: string): Promise<void>; private closeClient; shutdown(): Promise<void>; run(token: string, commandArgs: string[]): Promise<any>; pipeline(token: string, commands: string[][], transaction: boolean): Promise<any>; script(token: string, filePath: string, keys: string[], args: string[]): Promise<any>; generateUniqueToken(prefix: string): string; [Symbol.asyncDispose](): Promise<void>; }