redis-connection-pool
A node.js connection pool for Redis.
![downloads](http://img.shields.io/npm/dm/redis-connection-pool.svg?style=flat)
About
node-redis-connection-pool is 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 resources.
Installation
npm install redis-connection-pool
Usage
import redisPoolFactory from 'redis-connection-pool';
const redisPool = await redisPoolFactory('myRedisPool', {
max_clients: 5,
redis: {
url: 'redis://localhost:6379'
}
});
await redisPool.set('test-key', 'foobar');
const foo = await redisPool.get('test-key');
Or you can create a pool instance directly
import RedisConnectionPool from 'redis-connection-pool';
const redisPool = new RedisConnectionPool();
await redisPool.init();
Implemented methods
get(key)
set(key, value, ttl)
expire(key, value)
del(key)
hget(key, field)
hgetall(key)
hset(key, field, value)
hdel(key, [fields])
brpop(key)
brpoplpush(key1, key2)
blpop(key)
rpush(key, value)
lpush(key, value)
sendCommand(commandName, [args])
shutdown()
API Documentation
node-redis-connection-pool uses jsdoc-to-markdown to generate the API.md from the source code.
License
MIT