RedisPool

RedisPool

new RedisPool(options)

Source:
Parameters:
Name Type Description
options object

Accepts properties ["name", "redisOptions", "poolOptions", "logger"]

Properties
Name Type Description
name string

Name your pool

redisOptions object

opts from node_redis#options-object-properties

poolOptions object

opts from node-pool#createpool

logger object

Inject your custom logger

Methods

acquire(priority, db) → {promise}

Source:

Acquire a Redis connection and use an optional priority.

Parameters:
Name Type Description
priority number

priority list number

db number

Use the db with range {0-16}

Returns:

Promise resolve with the connection or Error

Type
promise

availableCount() → {number}

Source:

Returns available connections count of the pool

Returns:

available connections count of the pool

Type
number

destroy(client) → {promise}

Source:

Destroy a Redis connection.

Parameters:
Name Type Description
client object

Redis connection

Returns:

Promise

Type
promise

drain() → {promise}

Source:

Drains the connection pool and call the callback id provided.

Returns:

Promise

Type
promise

getName() → {string}

Source:

Returns factory.name for this pool

Returns:

Name of the pool

Type
string

getPoolOptions() → {object}

Source:

Returns this.poolOptions for this pool

Returns:

pool options given

Type
object

getPoolSize() → {number}

Source:

Returns size of the pool

Returns:

size of the pool

Type
number

getRedisOptions() → {object}

Source:

Returns this.redisOptions for this pool

Returns:

redis options given

Type
object

pendingCount() → {number}

Source:

Returns pending connections count of the pool

Returns:

pending connections count of the pool

Type
number

release(client) → {promise}

Source:

Release a Redis connection to the pool.

Parameters:
Name Type Description
client object

Redis connection

Returns:

Promise

Type
promise

sendCommand(commandName, commandArgs) → {promise}

Source:

Send redis instructions

Parameters:
Name Type Description
commandName string

Name of the command

commandArgs array

Args sent to the command

Returns:

Promise resolve with the result or Error

Type
promise

status() → {object}

Source:

Returns pool status and stats

Returns:

pool status and stats

Type
object