Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/segment-boneyard/redis-lock
Node redis lock implementation for locking with a TTL.
https://github.com/segment-boneyard/redis-lock
Last synced: about 5 hours ago
JSON representation
Node redis lock implementation for locking with a TTL.
- Host: GitHub
- URL: https://github.com/segment-boneyard/redis-lock
- Owner: segment-boneyard
- Created: 2014-03-19T20:57:23.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-12T17:54:17.000Z (over 10 years ago)
- Last Synced: 2024-04-09T16:31:14.522Z (7 months ago)
- Language: JavaScript
- Size: 201 KB
- Stars: 12
- Watchers: 37
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
[![Build Status](https://circleci.com/gh/segmentio/redis-lock.png?circle-token=)](https://circleci.com/gh/segmentio/redis-lock)
# redis-lock
Node redis lock implementation for locking with a TTL. Requires redis 2.6.12 or above.
## Installation
```
$ npm install segmentio/redis-lock
```## Example
```js
var redis = require('redis').createClient();
var Lock = require('redis-lock');var lock = new Lock({
name: 'locks:something',
redis: redis,
timeout: '10s;' // or number
});// try acquiring lock
lock.lock(function(err, locked){});
// try acquiring lock with retry interval
lock.retry(function(err){}, 500);
```# License
MIT