kredis v 1.0.3
We follow (breaking).(feature).(fix) versioning
ioredis with most used redis functionalities
A wrapper overUsage:
; const client = host: 'localhost' port: '6379' keyPrefix: 'app.'; // API client;// optional, returns a promise client;// call when you want to disconnect. returns a promise client;// set a value in redis for a particular lifetime in MILLISECONDS// sets the value permanently if no lifetime is provided// client.set('foo', {x: 1, y: 2}, 10000);// returns a promise client;// here values is an object of the form:// {key1: val1, key2: val2 ...and so on}// lifetime is optional client// get a value from redis// returns a promise wrapping the JSON.parsed value client// get values from redis for an array of keys// returns a promise wrapping the JSON.parsed values client// delete a key from redis// returns a promise client// delete an array of keys from redis// returns a promise clientclearprefix// clear all keys with a certain prefix// honors keyPrefix from connection config// returns promise client// vals can be array or object// enqueues the vals in a queue stored with key `queue`// useful for simple communication b/w servers// returns a promise client// returns all the items in the queue client// dequeue the queue named `queue`// returns a promise const tasksQueue = client;tasksQueue;tasksQueue;tasksQueue;tasksQueueclear;// simply a shorthand for working with a queue const usersHash = clienthash'users';usersHash;usersHash;usersHashclear;// simply a shorthand for working with a namespaced key-value store
Testing
- Copy
test/config.sample.js
totest/config.js
. Make changes as needed - Run
npm run test