Expand description
redlock-rs is an implementation of the distributed locking mechanism built on top of Redis.
It is more or less a port of the Ruby version.
Basic Operation
let rl = RedLock::new(vec![
"redis://127.0.0.1:6380/",
"redis://127.0.0.1:6381/",
"redis://127.0.0.1:6382/"]);
let lock;
loop {
match rl.lock("mutex".as_bytes(), 1000) {
Ok(Some(l)) => { lock = l; break },
Ok(None) => (),
Err(e) => panic!("Error communicating with redis: {}", e)
}
}
// Critical section
rl.unlock(&lock);
Structs
- The lock manager.