redlock-rs

Build Status

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

Installation

toml [dependencies] rust_redlock = "0.5.3"

Documentation

See: https://docs.rs/rustredlock/0.1.0/rustredlock

Usage

```rust let redlock = Redlock::new(Config { addrs: vec!["redis1.example.com", "redis2.example.com", "redis2.example.com"], retrycount: 10, retrydelay: time::Duration::frommillis(400), retryjitter: 400, drift_factor: 0.01, })?;

// Acquire the lock of the specified resource. let lock = redlock.lock("resourcenametolock", time::Duration::frommillis(1000))?; // Release the lock of the resource when you are done. lock.unlock()?; ```