Leader election backed by Redis
- Redis 2.6.12
 
npm install redis-leader
var Leader = require('redis-leader');Create a new Leader
redis is a string key identifying the lock
ttl Lock time to live in milliseconds (will be automatically released after that time)
wait Time between 2 tries getting elected (ms)
Release the lock for others.
Tells if he got elected.
callback(err, true/false)
elected when your candidate become leader
revoked when your leader got revoked from his leadership
error when an error occurred, best is to exit your process
It uses setnx command to try to set a semaphore with the ttl given in options.
- If it succeeds, it gets elected and will renew the semaphore every 
ttl/2ms. - If it fails or get revoked, it tries to get elected every 
waitms. 
MIT