Create a list of hashes sorted by id backend by redis (useful to create queues with data).
nodejs:
$ npm install list-redis
var list = require('list-redis');
var queue = list('mylist');
All functions take either an args Array plus optional callback because operations with redis are asynchronous.
Create new hash in list and return its id.
queue.add({
name: 'bredele'
}, function(err, id) {
//do something
})
Hashes are optional:
queue.add(function(err, id) {
//do something
})
Get hash by id.
queue.get(12, function(err, hash) {
//do something
});
Return true if list set exists.
queue.has(12, function(err, exists) {
//do something
});
Delete list set.
queue.del(12, function(err) {
//do something
});
Delete list set and hash:
queue.del(12, true, function(err) {
//do something
});
Atomically removes the set of the list stored at source, and pushes the set to the list stored at destination.
var other = list('otherList');
queue.move(12, other, function(){
//do something optional
});