@albert-team/red

0.9.0 • Public • Published

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.

Dependencies (1)

Dev Dependencies (1)

Package Sidebar

Install

npm i @albert-team/red

Weekly Downloads

19

Version

0.9.0

License

MIT

Unpacked Size

10.6 kB

Total Files

8

Last publish

Collaborators

  • lqmanh