0.0.0 • Published 12 years ago
list-redis v0.0.0
list-redis
Create a list of hashes sorted by id backend by redis (useful to create queues with data).
Installation
nodejs:
$ npm install list-redisAPI
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.
.add(hash, callback)
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(id, callback)
Get hash by id.
queue.get(12, function(err, hash) {
//do something
});.has(id, callback)
Return true if list set exists.
queue.has(12, function(err, exists) {
//do something
});.get(id, callback)
Delete list set.
queue.del(12, function(err) {
//do something
});Delete list set and hash:
queue.del(12, true, function(err) {
//do something
});0.0.0
12 years ago