0.2.3 • Published 2 years ago

redis-v3-promise v0.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Redis (v3) Promise Client

This package is for those who want to use the node-redis version 3.x, that supports createClient configuration options like: prefix, rename_commands, but also want the full promise and type definitions support of version 4.x.

This package is a wrapper built on top of redis-v3 (github). Do checkout the docs for that package for details related to node-redis.

Installation

npm install redis-v3-promise

Supported for Node >= 12.x

Usage

Example

const redis = require('redis-v3-promise');
const client = redis.createClient();

// client.native is the native client created by node-redis lib
client.native.on('error', function(error) {
  console.error(error);
});

client
  .set('key', 'value')
  .then(console.log)
  .catch(console.error);

client
  .get('key')
  .then(console.log)
  .catch(console.error);

Types Support

Type-Support.gif

Important: client.native is the native client created by node-redis lib. For listening to errors or using all other functions provided by the native redis client (other than the redis commands) do use the client.native object.

For full list of supported commands, options and docs, please check this: redis-v3

Native Redis Object

In case the native v3 redis object is required (assertions for tests, etc), use this:

const {
  AbortError,
  AggregateError,
  ReplyError,
} = require('redis-v3-promise').v3;
0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago