Skip to content

indatawetrust/list-redis-promise

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Travis Build Status

list-redis

Create a list of hashes sorted by id backend by redis (useful to create queues with data).

Installation

nodejs:

$ npm install list-redis-promise

API

const list = require('list-redis-promise');
const queue = list('mylist');

All functions take either an args Array plus optional callback because operations with redis are asynchronous.

.push(hash)

Create new hash in list and return its id.

queue.push({
  name: 'bredele'
})
.then(id => {

})
.catch(err => {

})

.get(id)

Get hash by id.

queue.get(12)
.then(hash => {

})
.catch(err => {

})

.has(id)

Return true if list set exists.

queue.has(12)
.then(exists => {

})
.catch(err => {

})

.del(id)

Delete list set.

queue.del(12)
.then(() => {

})
.catch(err => {

})

Delete list set and hash:

queue.del(12, true)
.then(() => {

})
.catch(err => {

})

.move(id, list)

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)
.then(exists => {

})
.catch(err => {

})

About

Queue of hashes sorted by id and backend by redis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%