mutis
mutexes for node.js, powered by redis
usage
pass an already instantiated redis client to the constructor, you can then use the .lock()
and .unlock()
methods:
'use strict'; const Redis = ;const Mutis = ; const client = Redis;const mutex = client; mutex;
mutis will wait for the lock to be available before returning, by the time your .then()
is called your lock is acquired.
you can pass a second argument to .lock()
to be used as a timeout, for example:
mutex;
for additional usage examples, see the tests