Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/badboy/redlock-rs
Distributed locks with Redis, implemented in Rust
https://github.com/badboy/redlock-rs
Last synced: 3 days ago
JSON representation
Distributed locks with Redis, implemented in Rust
- Host: GitHub
- URL: https://github.com/badboy/redlock-rs
- Owner: badboy
- License: bsd-3-clause
- Created: 2014-10-17T15:09:29.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2024-09-28T21:19:56.000Z (4 months ago)
- Last Synced: 2025-01-10T16:10:04.165Z (10 days ago)
- Language: Rust
- Homepage: http://badboy.github.io/redlock-rs/
- Size: 2.03 MB
- Stars: 55
- Watchers: 5
- Forks: 15
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# redlock-rs - Distributed locks with Redis
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/badboy/redlock-rs/CI)
![Crates.io](https://img.shields.io/crates/v/redlock)This is an implementation of Redlock, the [distributed locking mechanism][distlock] built on top of Redis.
It is more or less a port of the [Ruby version][redlock.rb].It includes a sample application in [main.rs](src/main.rs).
## Build
```
cargo build --release
```## Usage
```rust
use redlock::RedLock;fn main() {
let rl = RedLock::new(vec!["redis://127.0.0.1:6380/", "redis://127.0.0.1:6381/", "redis://127.0.0.1:6382/"]);let lock;
loop {
match rl.lock("mutex".as_bytes(), 1000) {
Some(l) => { lock = l; break }
None => ()
}
}// Critical section
rl.unlock(&lock);
}```
## Tests
Run tests with:
```
cargo test
```Run sample application with:
```
cargo run --release
```## Contribute
If you find bugs or want to help otherwise, please [open an issue](https://github.com/badboy/redlock-rs/issues).
## Maintainer
* From 2014 to June 2021 this crate was owned and maintained by [@badboy](https://github.com/badboy/)
* From June 2021 on this crate is maintained by [@aig787](https://github.com/aig787)## License
BSD. See [LICENSE](LICENSE).
[distlock]: http://redis.io/topics/distlock
[redlock.rb]: https://github.com/antirez/redlock-rb