redis

(redis).Connect(host, port, password) ⇒ boolean

Connect tries to connect redis server with password

Kind: inner method of redis
Returns: boolean - - The status of the connection.
Throws:

  • error - The error encountered during connection.
ParamTypeDescription
hoststringThe host of the redis server.
portnumberThe port of the redis server.
passwordstringThe password for the redis server.

Example

let m = require('nuclei/redis'); 
let status = m.Connect('localhost', 6379, 'password');

(redis).GetServerInfo(host, port) ⇒ string

GetServerInfo returns the server info for a redis server

Kind: inner method of redis
Returns: string - - The server info.
Throws:

  • error - The error encountered during getting server info.
ParamTypeDescription
hoststringThe host of the redis server.
portnumberThe port of the redis server.

Example

let m = require('nuclei/redis'); 
let info = m.GetServerInfo('localhost', 6379);

(redis).GetServerInfoAuth(host, port, password) ⇒ string

GetServerInfoAuth returns the server info for a redis server

Kind: inner method of redis
Returns: string - - The server info.
Throws:

  • error - The error encountered during getting server info.
ParamTypeDescription
hoststringThe host of the redis server.
portnumberThe port of the redis server.
passwordstringThe password for the redis server.

Example

let m = require('nuclei/redis'); 
let info = m.GetServerInfoAuth('localhost', 6379, 'password');

(redis).IsAuthenticated(host, port) ⇒ boolean

IsAuthenticated checks if the redis server requires authentication

Kind: inner method of redis
Returns: boolean - - The authentication status.
Throws:

  • error - The error encountered during checking authentication.
ParamTypeDescription
hoststringThe host of the redis server.
portnumberThe port of the redis server.

Example

let m = require('nuclei/redis'); 
let isAuthenticated = m.IsAuthenticated('localhost', 6379);

(redis).RunLuaScript(host, port, password, script)

RunLuaScript runs a lua script on the redis server

Kind: inner method of redis
Throws:

  • error - The error encountered during running the lua script.
ParamTypeDescription
hoststringThe host of the redis server.
portnumberThe port of the redis server.
passwordstringThe password for the redis server.
scriptstringThe lua script to run.

Example

let m = require('nuclei/redis'); 
m.RunLuaScript('localhost', 6379, 'password', 'return redis.call(\'ping\')');