Name: node-redis-wrapper
Owner: Namshi
Description: null
Created: 2017-04-16 09:21:05.0
Updated: 2017-06-10 13:32:40.0
Pushed: 2017-09-13 07:22:28.0
Homepage: null
Size: 5
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A small, promise-based, pooled wrapper for the redis
module:
we re-use the same code across a bunch of modules, hence this
abstraction.
Given a confg object such as:
: redis
: 6379
:
x: 20
n: 2
quireTimeoutMillis: 3000
You can then start using redis with:
t redis = require('node-redis-wrapper')(config)
s.del('some-key').then(...).catch(...)
r with async/await
t redis.del('some-key')
If you want to control how the redis client is created (eg. to use redis-sentinel & the likes), you can just specify a createClient
function in the config:
config = {...}
ig.createClient = function() {
quire('redis-sentinel').createClient(...options...)
t redis = require('node-redis-wrapper')(config)