Socket
Socket
Sign inDemoInstall

@abeai/node-redis

Package Overview
Dependencies
13
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @abeai/node-redis

Wrapper for NodeRedis.


Version published
Maintainers
2
Install size
526 kB
Created

Readme

Source

Wrapper for ioredis.

Overview

The redis module provides promisified redis commands.

Installation

npm install @abeai/node-redis

Instantiation

With afterInitialization hook

const redis = require('@abeai/node-redis');

redis.init(host, options);

// Will wait until the redis client is created and connected to server
redis.afterInitialization(function() {
	redis.client().get('some_key')
	    .then((value) => {
	        console.log(value);
	    })
	    .catch((err) => {
	        console.log(err, 'Failed to get some_key');
	    })
	;
});

Without afterInitialization hook

const redis = require('@abeai/node-redis');

redis.init(host, options);
redis.client().get('some_key')
    .then((value) => {
        console.log(value);
    })
    .catch((err) => {
        console.log(err, 'Failed to get some_key');
    })
;

Interface

init(host[, options])

Creates a new redis client instance.

Options
redis

Key value dictionary of ioredis options.

logger

Custom logger to be used by client.

client()

Returns the redis client instance which includes all standard redis commands via ioredis. The command function names are lowercase and all functions return a promise.

afterInitialization()

Handler attached to the underlying redis client's ready event. This is only called once when the client connects to the server for the first time.

onReady()

Handler attached to the underlying redis client's ready event. This is called every time the client connects to the server including reconnects.

Keywords

FAQs

Last updated on 21 Jul 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc