Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BlackHades/redis-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redis-lib

This is a wrapper around ioredis which provides automatic reconnects.

Features

  • Uses ioredis for connection management
  • Easy Installation and Use
  • Simple Exposed Functions
  • Supports all redis commands supported by ioredis
  • Clear Error Response

Installation

"dependencies": {
    "redis-lib": "^0.0.3"
}

npm install redis-lib

Initialization

const redis = require("redis-lib")({
    appName: "test-file",
    url: "redis://localhost:6379"
})
//when initializing redis, pass in the url
//When no url is passed, REDIS_CLUSTER_URL and/or REDIS_URL from process.env is used
//When using cluster, URL should be passed as "redis://:password@host:port-1,redis://:password@host:port-2,redis://:password@host:port-3"

Basic functionality

  • Set A Value
const response = await redis.set("new", "old");
  • Get A Value
//(async/await)
const response = await redis.get("new");

-- To close a connection

    redis.disconnect();

Tests

Cli

npm install
npm test

Contributors

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published