Crates.io | redis-lock |
lib.rs | redis-lock |
version | |
source | src |
created_at | 2024-10-22 16:11:02.308022 |
updated_at | 2024-10-24 10:42:58.459356 |
description | Rusty distributed locking backed by Redis. |
homepage | |
repository | https://github.com/JonathanWoollett-Light/redis-lock |
max_upload_size | |
id | 1418889 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Rusty distributed locking backed by Redis.
// Setup.
redis_lock::setup(&client).await?;
// Get lock.
let mut lock = redis_lock::MultiResourceLock::new(client.clone())?;
let resources = vec![String::from("account1"), String::from("account2")];
// Execute a function with the lock.
lock.map_default(&resources, async move { /* .. */ }).await?;
I would recommend this library over rslock when your application does operations that require exclusive access to multiple resources.