You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

redis-url-plus

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-url-plus

Redis Connect URL parser aligned with Redis-CLI commands

1.2.1
latest
Source
npmnpm
Version published
Weekly downloads
567
-13.7%
Maintainers
1
Weekly downloads
 
Created
Source

redis-url-plus

NPM version Codacy build status Test coverage npm downloads/month npm downloads

Redis Connect URL parser aligned with Redis-CLI commands

Features

  • Standalone
  • Cluster
  • Sentinel
  • Unix Domain Socket

Install

$ yarn add redis-url-plus
# or
$ npm i redis-url-plus

Usage

# standalone/cluster
redis://username:password@host:port/db[,redis://username:password@host:port/db]

# sentinel
redis-sentinel://[username:password@]host:port[,host:port]/master_name/db

# unix domain socket
socket://tmp/redis.sock

# cluster
redis-cluster://host:port[,host:port]
const RedisUrlParser = require('redis-url-plus');

RedisUrlParser('redis://localhost:6379/0');

// redis://localhost:6379/0 ==> { password: '', db: 0, port: 6379, host: 'localhost' }
// redis://localhost:6379, ==> { password: '', db: 0, port: 6379, host: 'localhost' }
// redis://user:pass@localhost:6379, ==> { password: 'pass', db: 0, port: 6379, host: 'localhost' }
/**
 * redis://localhost:6379,redis://localhost:6378,redis://localhost:6377
 *
 * ||
 * 
 * {
 *   cluster: true,
 *     nodes: [
 *      { password: '', db: 0, port: 6379, host: 'localhost' },
 *      { password: '', db: 0, port: 6378, host: 'localhost' },
 *      { password: '', db: 0, port: 6377, host: 'localhost' }
 *    ]
 * }
 **/

// redis-sentinel://sentinel:26379/mymaster/0 ==> { db: 0, name: 'mymaster', sentinels: [{ host: 'sentinel', port: 26379 }] }
/**
 * 
 * redis-sentinel://usr:pwd@sentinel:26379/mymaster/0
 * 
 * ||
 * 
 * { username: 'usr', password: 'pwd', db: 0, name: 'mymaster', sentinels: [{ host: 'sentinel', port: 26379 }] }
 *  
 **/

// socket://tmp/redis.sock ==> { path: '/tmp/redis.sock' }

// redis-cluster://localhost:6379 ==> { cluster: true, nodes: [{ host: 'localhost', port: 6379 }] }
/**
 * 
 * redis-cluster://localhost:6379,localhost:6380
 * 
 * ||
 * 
 * { cluster: true, nodes: [{ host: 'localhost', port: 6379 }, { host: 'localhost', port: 6380 }] }
 *  
 **/

Support Version

  • 10
  • 12
  • 14
  • 16

Keywords

redis-url

FAQs

Package last updated on 07 Apr 2024

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