#redlock #redis #lock #mutex #distribution

rust_redlock

A Rust Redlock implementation for distributed, highly-available redis locks

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

#7 in #addrs

Download history 9/week @ 2023-11-06 1/week @ 2023-11-13 10/week @ 2023-11-20 29/week @ 2023-11-27 10/week @ 2023-12-04 12/week @ 2023-12-18 18/week @ 2023-12-25 1/week @ 2024-01-01 1/week @ 2024-01-08 9/week @ 2024-01-15 9/week @ 2024-01-22 20/week @ 2024-01-29 5/week @ 2024-02-05 52/week @ 2024-02-12 158/week @ 2024-02-19

235 downloads per month

MIT license

17KB
404 lines

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()?;

lib.rs:

A rust redlock implementation for distributed, highly-available redis locks.

Dependencies

~3.5MB
~90K SLoC