Detalhes do pacote

@albert-team/red

albert-team122MIT0.9.0

Minimalistic Redis client for Node.js

minimal, minimalistic, redis, client

readme (leia-me)

RED

Minimalistic Redis client for Node.js

Credits

Red is a fork of djanowski/yoredis. Many thanks to Damian Janowski and his great work.

Installation

Requirements

  • Node.js >= 8.0.0
  • Redis

Instructions

  • With npm:
npm i @albert-team/red
  • With yarn:
yarn add @albert-team/red

Usage

Quick Start

const Red = require('@albert-team/red')

const main = async () => {
  const client = new Red('127.0.0.1', 6379)

  console.log(client.ready) // false
  await client.connect()
  console.log(client.ready) // true

  console.log(await client.call('PING')) // PONG
  console.log(await client.callOne(['GET', 'key1'])) // null
  console.log(
    await client.callMany([['SET', 'key1', 'val1'], ['GET', 'key1'], ['GET', 'key2']])
  ) // [ 'OK', 'val1', null ]

  console.log(client.disconnected) // false
  await client.disconnect()
  console.log(client.disconnected) // true
}

main()

Authentication

You can either pass the password to the constructor

const client = new Red('127.0.0.1', 6379, { password: 'scrtpassword' })

or call this method manually

client.authenticate('scrtpassword')

Changelog

Read more here.

changelog (log de mudanças)

CHANGELOG

v0.9.0

FEATURES

  • Drop Node.js 8 support

v0.8.0

FEATURES

  • Remove node-wait-until dependency
  • Remove timeout option

v0.7.1

PATCHES

  • Fix compatibility with Node < v9.11.0

v0.7.0

FEATURES

  • Convert command args to '' if they're null or undefined

v0.6.0

FEATURES

  • Allow users to manually call RedisClient.authenticate(password)
  • Start writing tests and documentation

v0.5.0

FEATURES

  • Support authentication

v0.4.0

FEATURES

  • Add options parameter to RedisClient
  • Add RedisClient.callOne(), similar to RedisClient.call() but takes a command as an array as the 1st parameter

v0.3.0

FEATURES

  • Automatically convert command arguments to strings
  • Increase waiting timeout of connect() and disconnect() of RedisClient

v0.2.0

FEATURES

  • Fully support Promise

v0.1.0

FEATURES

  • Fork Red from djanowski/yoredis with basic features of a Redis client
  • Vastly refactor codebase

PATCHES

  • A minor bug associated with "completed" state of a failed PipelineOperation