redmutex
v0.1.0
Published
easy peasy locking using redis
Downloads
3
Readme
redmutex
easy peasy locking using redis
Installation
npm install --save redmutex redis
Example
const redis = require('redis')
const redmutex = require('redmutex')
const client = redis.createClient()
const createMutex = redmutex(client)
// createMutex(name, ttl, callback)
createMutex('test', 10, (err, release) => {
if (err) return console.log(err)
setTimeout(() => {
console.log('just finished doing some hard work!!!')
release(() => client.quit())
}, 7500)
})
Testing
Code is linted with eslint and tested with Jest. Run npm test
to lint and run
test suite.
License
Released under the terms of the 3-Clause BSD License. See LICENSE
for more
information.