RedisStore

RedisStore

new RedisStore(options)

Source:
Parameters:
Name Type Description
options object

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

Properties
Name Type Description
name string

Name your store

redisOptions object

opts from node_redis#options-object-properties

poolOptions object

opts from node-pool#createpool

logger object

Inject your custom logger

Methods

del(keys) → {number}

Source:

Returns the number of keys that were removed - See redis del

Parameters:
Name Type Description
keys array

list of keys to delete

Returns:

The number of keys that were removed.

Type
number

deleteAll(pattern) → {array}

Source:

Deletes all keys matching pattern

Parameters:
Name Type Description
pattern string

glob-style patterns/default '*'

Returns:

The number of keys that were removed.

Type
array

expire(key, ttlInSeconds) → {number}

Source:

Returns 1 if the timeout was set/ 0 if key does not exist or the timeout could not be set - See redis expire

Parameters:
Name Type Description
key string

key to set expire

ttlInSeconds number

time to live in seconds

Returns:

1 if the timeout was set successfully; if not 0

Type
number

get(key) → {string}

Source:

Returns value or null when the key is missing - See redis get

Parameters:
Name Type Description
key string

key for the value stored

Returns:

value or null when the key is missing

Type
string

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

getRedisOptions() → {object}

Source:

Returns this.redisOptions for this pool

Returns:

redis options given

Type
object

keys(pattern) → {array}

Source:

Returns all keys matching pattern - See redis keys

Parameters:
Name Type Description
pattern string

glob-style patterns/default '*'

Returns:

all keys matching pattern

Type
array

ping() → {string}

Source:

Returns 'PONG'

Returns:

'PONG'

Type
string

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

set(key, value, ttlInSeconds) → {string}

Source:

Returns 'OK' if successful

Parameters:
Name Type Description
key string

key for the value stored

value string

value to stored

ttlInSeconds number

time to live in seconds

Returns:

'OK' if successful

Type
string

status() → {object}

Source:

Returns pool status and stats

Returns:

pool status and stats

Type
object

ttlInSeconds(key) → {number}

Source:

Returns TTL in seconds, or a negative value in order to signal an error - See redis ttl

Parameters:
Name Type Description
key string

list of keys to delete

Returns:

TTL in seconds, or a negative value in order to signal an error

Type
number