New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@luckbox/redis

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@luckbox/redis

Provides a wrapper that handles some of the connection deficiencies of the "redis" 2.x.x package

latest
Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
8
14.29%
Maintainers
2
Weekly downloads
 
Created
Source

node-redis

A wrapper that handles some of the connection deficiencies of the "redis" 2.x.x package.

Motivation

When using Redis in a high-availability environment, one might find that in some cases the NodeRedis's retry_strategy might not provide enough flexibility. If the server does not come back before the next reconnection attempt happens, the client hangs until the underlying socket times out, usually 120 seconds - the system's default. If however, the connection_timeout is lowered so that the the reconnection attempts are given up on sooner, once the socket times out no further attempts are made, rendering the retry_strategy useless.

Usage

This wrapper can be used as a drop in replacement for the NodeRedis library, as it exposes the same API interface.

Example

const redis = require('@luckbox/redis');

const client = redis.createClient({
  host: '127.0.0.1',
  port: 6379,
  heartbeat_interval: 10000,
  heartbeat_timeout: 5000
});

client.on('heartbeat-timeout', error => {
  console.warn('Connection to Redis lost. Retrying...', error);
});

client.set('myKey', 'foo', redis.print);
...

API

For general usage, refer to the official documentation.

The following additional functionality has been added:

Initialization options

NameDefaultDescription
heartbeat_interval5000How often to check the connection's health in milliseconds
heartbeat_timeout1000How long before a heartbeat times out in milliseconds

Events

heartbeat-timeout client will emit heartbeat-timeout when the last heartbeat has timed out.

FAQs

Package last updated on 18 May 2021

Did you know?

Socket

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