redispool-js

1.0.1 • Public • Published

RedisPool - an Asynchronous node.js redis pool client

===========================

This is wrapper of Node_redis by pooling a lot of RedisClient connections to increase performance.

Install

npm install redispool-js

Dependencies

  • bluebird

  • node_redis

Usage

initialize

 
var  RedisPool  =  require('redispool-js');
 
 
//call init which the same option of construction of RedisClient.
//Just add `maxConnections` to create number of RedisClient in pool
 
RedisPool.init({
    port:  6379,
    host:  'localhost',
    options: {},
    maxConnections:  50,
    handleRedisError:  true
})
 

After calling init, RedisPool create maxConnections connnection ready to use.

API

We use blubird to promisify all RedisClient functions. So all functions are async|await function adding Async to the end. See Redis api for more information.

Eg:

 
await  RedisPool.setAsync('something','some value');
let  value  =  await  RedisPool.getAsync('something');
 

When calling command function, RedisPool pop a free RedisClient connection, using it to query command and then push back it to the pool.

License

MIT

Package Sidebar

Install

npm i redispool-js

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

7.67 kB

Total Files

4

Last publish

Collaborators

  • namdn