rust_redlock

Crates.iorust_redlock
lib.rsrust_redlock
version0.4.0
sourcesrc
created_at2017-05-18 14:36:10.342568
updated_at2017-08-02 14:52:22.704919
descriptionA Rust Redlock implementation for distributed, highly-available redis locks
homepagehttps://github.com/DavidCai1993/redlock-rs
repositoryhttps://github.com/DavidCai1993/redlock-rs
max_upload_size
id15043
size18,802
David Cai (DavidCai1993)

documentation

https://docs.rs/rust_redlock/0.4.0/rust_redlock

README

redlock-rs

Build Status

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()?;
Commit count: 33

cargo fmt