0.1.2 • Published 9 years ago
pd-redis-lock v0.1.2
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...
});