namshi/node-redis-wrapper

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

node-redis-wrapper

A small, promise-based, pooled wrapper for the redis module: we re-use the same code across a bunch of modules, hence this abstraction.

Usage

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')
Custom constructor

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)

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.