npm.io
0.1.2 • Published 11 years ago

pd-redis-lock

Licence
MIT
Version
0.1.2
Deps
3
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

pd-redis-lock

A pessimistic lock implementation based on Redis

var lock = require('pd-redis-lock');
lock('mylock', function(){
   //do my stuff
   //when it is done it will be unlocked
   //if there is asynchronous work, it can be wrapped in a q.Promise and returned
   return q.Promise(function(resolve){
      resolve(...)
   }).then(...);
}, 1000).then(function(){
   //do stuff after it is unlocked...
});

Keywords