redis-client-wrapper
v0.1.8
Published
simple wrapper for redis clients
Downloads
11
Readme
redis-client-wrapper - a node.js wrapper for redis clients
Install with:
npm install redis-client-wrapper
Usage
create redis tlient
var RediedisClientWrapper = require('redis-client-wrapper');
var redisClient = RediedisClientWrapper.createClient(port, host, db_num, redisOptions);
getting redis client
var RediedisClientWrapper = require('redis-client-wrapper');
var redisClient = RediedisClientWrapper.getClient();
get client by name
var redisClient = RediedisClientWrapper.getClientByName("my_client_name");
get client by port
var redisClient = RediedisClientWrapper.getClientByPort(6379)
get client by db number
var redisClient = RediedisClientWrapper.getClientByDbNum(0);
get client by host
var redisClient = RediedisClientWrapper.getClientByHost("localhost");
get default client
var redisClient = RediedisClientWrapper.getDefaultClient();
set client default
RediedisClientWrapper.getDefaultClient(redisClient, true/false);
overloading createClient
createClient(port, host, db_num, redisOptions);
createClient(port, host, redisOptions);
createClient(port, host, db_num);
createClient(port, host)
createClient(options)
parameters
port
- the port number (default is6379
)host
server's host name (default is127.0.0.1
)db_num
- number of db (default is0
)redisOptions
- redis options (see https://www.npmjs.com/package/redis#overloading for more info)options
- an object with the following possible properties:port
,host
,db_num
,options
options example
{
"port":6379,
"host":"127.0.0.1",
"db_num":1,
"default":true,
"client_name":1,
"options":{
"auth_pass":"my_password"
}
}