promisify-redis

0.0.5 • Public • Published

promisify-redis

Build Status

Native promises for redis.

Features

  • Native promises
  • Supports multi and batch
  • Doesn't mutate the library

Usage

Wrap the library:

const promisifyRedis = require('promisify-redis');
const redis = promisifyRedis(require('redis'));
 
const client = redis.createClient();
 
async function doSomething() {
  await client.set('foo', 'bar');
  return client.get('foo');
}

Or wrap just a single client

const promisifyRedis = require('promisify-redis');
const redis = require('redis');
 
const client = promisifyRedis(redis.createClient());

Multi

.exec() will return a promise:

await client.multi()
  .set('foo', 'bar')
  .get('foo')
  .exec();

Duplicate

.duplicate() only supports the synchronous version of the original library. It is still synchronous and will return a promisified client.

Readme

Keywords

Package Sidebar

Install

npm i promisify-redis

Weekly Downloads

28

Version

0.0.5

License

MIT

Unpacked Size

4.97 kB

Total Files

3

Last publish

Collaborators

  • janpotoms