9 unstable releases (3 breaking)
Uses old Rust 2015
0.4.0 | May 22, 2017 |
---|---|
0.3.2 | May 21, 2017 |
0.2.2 | May 19, 2017 |
0.1.1 | May 19, 2017 |
#5 in #redlock
17KB
404 lines
redlock-rs
A Rust Redlock implementation for distributed, highly-available redis locks.
Installation
[dependencies]
rust_redlock = "0.4.0"
Documentation
See: https://docs.rs/rust_redlock/0.4.0/rust_redlock
Usage
let redlock = Redlock::new(Config {
addrs: vec!["redis1.example.com",
"redis2.example.com",
"redis3.example.com"],
retry_count: 10,
retry_delay: time::Duration::from_millis(400),
retry_jitter: 400,
drift_factor: 0.01,
})?;
// Acquire the lock of the specified resource.
let lock = redlock.lock("resource_name",
time::Duration::from_millis(1000))?;
// Release the lock of the resource when you are done.
lock.unlock()?;
lib.rs
:
A rust redlock implementation for distributed, highly-available redis locks.
Dependencies
~3MB
~77K SLoC