Skip to content

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

License

Notifications You must be signed in to change notification settings

DavidCai1111/redlock-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages