Minimalistic Redis client for Node.js
Red is a fork of djanowski/yoredis. Many thanks to Damian Janowski and his great work.
- Node.js >= 8.0.0
- Redis
- With npm:
npm i @albert-team/red- With yarn:
yarn add @albert-team/redconstRed=require('@albert-team/red')constmain=async()=>{constclient=newRed('127.0.0.1',6379)console.log(client.ready)// falseawaitclient.connect()console.log(client.ready)// trueconsole.log(awaitclient.call('PING'))// PONGconsole.log(awaitclient.callOne(['GET','key1']))// nullconsole.log(awaitclient.callMany([['SET','key1','val1'],['GET','key1'],['GET','key2']]))// [ 'OK', 'val1', null ]console.log(client.disconnected)// falseawaitclient.disconnect()console.log(client.disconnected)// true}main()You can either pass the password to the constructor
constclient=newRed('127.0.0.1',6379,{password: 'scrtpassword'})or call this method manually
client.authenticate('scrtpassword')Read more here.