Node Async lock (异步锁)
a simple node async lock that support ttl base memory database such as redis.
install
npm install node-async-lock
usage
node_redis demo :
var redis = client = redis; var ASYNCLOCK = ;var AsyncLock = { client; client; } { client; } { client } ttl:60 //the unit is second,defualt one day. namespace:'test-asynclock-ttl-' //default:async-lock-ttl-; eg1: { AsyncLock} eg2: { AsyncLock}
API
lock
AsyncLock
unlock
AsyncLock
remove
AsyncLock
getNameSpace
console;//test-asynclock-ttl