Interface RedisPoolOptions

interface RedisPoolOptions {
    acquireTimeout: number;
    cleanupDelay: number;
    clientSideCache?: ClientSideCacheConfig | PooledClientSideCacheProvider;
    maximum: number;
    minimum: number;
}

Properties

acquireTimeout: number

The maximum time a task can wait for a client to become available (>= 0).

cleanupDelay: number

The delay in milliseconds before a cleanup operation is performed on idle clients.

After this delay, the pool will check if there are too many idle clients and destroy excess ones to maintain optimal pool size.

Client Side Caching configuration for the pool.

Enables Redis Servers and Clients to work together to cache results from commands sent to a server. The server will notify the client when cached results are no longer valid. In pooled mode, the cache is shared across all clients in the pool.

Note: Client Side Caching is only supported with RESP3.

Example: Anonymous cache configuration

const client = createClientPool({RESP: 3}, {
clientSideCache: {
ttl: 0,
maxEntries: 0,
evictPolicy: "LRU"
},
minimum: 5
});

Example: Using a controllable cache

const cache = new BasicPooledClientSideCache({
ttl: 0,
maxEntries: 0,
evictPolicy: "LRU"
});
const client = createClientPool({RESP: 3}, {
clientSideCache: cache,
minimum: 5
});
maximum: number

The maximum number of clients to keep in the pool (>= RedisPoolOptions.minimum >= 1).

minimum: number

The minimum number of clients to keep in the pool (>= 1).

Generated using TypeDoc