new RedisCache(options)
- Source:
Parameters:
| Name | Type | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | Accepts properties ["name", "redisOptions", "poolOptions", "logger"] Properties
|
Methods
del(keys) → {number}
- Source:
Delete keys
Parameters:
| Name | Type | Description |
|---|---|---|
keys |
array | keys for the value stored |
Returns:
The number of keys that were removed.
- Type
- number
deleteAll(pattern) → {number}
- 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
- number
get(key) → {string}
- Source:
Returns value or null when the key is missing
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
getTtl(ttlInSeconds) → {number}
- Source:
Return the ttl or the default set on instantiation
Parameters:
| Name | Type | Description |
|---|---|---|
ttlInSeconds |
number | time to live in seconds |
Returns:
ttl
- Type
- number
keys(pattern) → {array}
- Source:
Returns all keys matching pattern
Parameters:
| Name | Type | Description |
|---|---|---|
pattern |
string | glob-style patterns/default '*' |
Returns:
all keys matching pattern
- Type
- array
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:
cache and its store status and stats
- Type
- object
wrap(key, fn, opts) → {string}
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
ttlInSeconds |
number | time to live in seconds |
Wraps promise to set its value if not exists.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string | key for the value stored |
fn |
function | function to call if not cache found |
opts |
object | options for wrap |
Returns:
'OK' if successful
- Type
- string