redis_mutex
Distributed mutex in Ruby using Redis.
Somewhat redis-mutex clone. The idea was taken from the official SETNX doc.
Installation
Add this to your application's shard.yml
:
dependencies:
redis_mutex:
github: Schniz/redis_mutex.cr
and have Redis installed
Usage
require "redis_mutex"
RedisMutex::Lock.run("SOME_KEY", 2.seconds) do
puts "This code runs and waits until unlock with maximum time of 2 seconds lock"
end
Contributing
- Fork it ( https://github.com/Schniz/redis_mutex.cr/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- Schniz Gal Schlezinger - creator, maintainer