Skip to content

Node redis lock implementation for locking with a TTL.

Notifications You must be signed in to change notification settings

gitadept/redis-lock

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

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

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

About

Node redis lock implementation for locking with a TTL.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 96.9%
  • Makefile 3.1%