redis-pool.js

Summary
redis-pool.js
Functions
RedisPoolA high-level redis management object.
onlisten for redis events
setExecute a redis SET command
getExecute a redis GET command
delExecute a redis DEL command
hsetExecute a redis HSET command
hgetExecute a redis HGET command

Functions

RedisPool

function RedisPool(uid,
cfg)

A high-level redis management object.  It manages a number of connections in a pool, using them as needed and keeping all aspects of releasing active connections internal to the object, so the user does not need to worry about forgotten connections leaking memory and building up over time.

Parameters

uid(string) - Unique identifer to retreive an existing instance from elsewhere in an application.  If left undefined, one will be generate automatically and avaialble via the `UID` property of the returned object.
cfg(object) - A series of configuration parameters to be optionally passed in and used during initialization of the object.
cfg.HOST(string) - Redis host (default: ‘127.0.0.1’)
cfg.PORT(number) - Redis port (default: 6379)
cfg.MAX_CLIENTS(number) - Max clients alive in the connection pool at once.  (default: 30)
cfg.PERFORM_CHECKS(boolean) - Perform a series of redis checks, currently this checks to to see if blocking push/pops can be used.  (default: false)

Returns

A redisPool object

on

RedisPool.prototype.on = function(type,
cb)

listen for redis events

Parameters

type(string) - Type of event to listen for.
cb(function) - Callback function when the event is triggered.

set

RedisPool.prototype.set = function (key,
data,
cb)

Execute a redis SET command

Parameters

key(string) - A key to assign value to
data(string) - Value to assign to key
cb(function) - Callback to be executed on completion

get

RedisPool.prototype.get = function (key,
cb)

Execute a redis GET command

Parameters

key(string) - The key of the value you wish to get
cb(function) - Callback to be executed on completion

del

RedisPool.prototype.del = function (key)

Execute a redis DEL command

Parameters

key(string) - The key of the value you wish to delete

hset

RedisPool.prototype.hset = function (key,
field,
data,
cb)

Execute a redis HSET command

Parameters

key(string) - A key to assign the hash to
field(string) - Name of the field to set
data(string) - Value to assign to hash
cb(function) - Callback to be executed on completion

hget

RedisPool.prototype.hget = function (key,
field,
cb)

Execute a redis HGET command

Parameters

key(string) - The key of the hash you wish to get
field(string) - The field name to retrieve
cb(function) - Callback to be executed on completion
function RedisPool(uid,
cfg)
A high-level redis management object.
RedisPool.prototype.on = function(type,
cb)
listen for redis events
RedisPool.prototype.set = function (key,
data,
cb)
Execute a redis SET command
RedisPool.prototype.get = function (key,
cb)
Execute a redis GET command
RedisPool.prototype.del = function (key)
Execute a redis DEL command
RedisPool.prototype.hset = function (key,
field,
data,
cb)
Execute a redis HSET command
RedisPool.prototype.hget = function (key,
field,
cb)
Execute a redis HGET command
Close