README
locker-redis
[![NPM Version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url]
Installation
$ npm install locker-redis
$ npm install ioredis
API
var RedisLocker = require('locker-redis');
var LockerTimeoutError = require('locker-redis').LockerTimeoutError;
var redisLocker = new RedisLocker(lockerName, options);
RedisLocker(name,options)
RedisLocker class
RedisLocker#acquire(function next(){})
Acquire redisLocker retry some times.If timeout then throw error.
redisLocker.acquire(function (err) {
if (err) {
return callback(new Error());
}
callback(null);
});
RedisLocker#release(function next(){})
Release this redisLocker
redisLocker.release();