This is an implementation of Redlock, the distributed locking mechanism built on top of Redis.
It is a fork of existing redlock-rs with async built on top of it.
cargo build --release
```rust use redlock::RedLock;
fn main() { 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".asbytes(), 1000).await { Ok(l) => { lock = l; break } Err() => () } }
// Critical section rl.unlock(&lock).await; }
```
Run tests with:
cargo test
Run sample application with:
cargo run --release
If you find bugs or want to help otherwise, please open an issue.
BSD. See LICENSE.