Distributed cache locker by redis.
$ npm install --save co-redis-locker
const RedisLocker = require('co-redis-locker');
const LockerTimeoutError = require('co-redis-locker').LockerTimeoutError;
RedisLocker class
const lockerName = 'user:100:account';
const options = {};
const redisLocker = new RedisLocker(lockerName, options);
Acquire redisLocker retry some times.If timeout then throw timeout error.
const locker = yield redisLocker.acquire();
Release this redisLocker
yield redisLocker.release();
Sync sleep wait function.