redis_mutex.cr

Distributed mutex in Ruby using Redis for Crystal

redis_mutex build status

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

  1. Fork it ( https://github.com/Schniz/redis_mutex.cr/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • Schniz Gal Schlezinger - creator, maintainer
Repository

redis_mutex.cr

Owner
Statistic
  • 1
  • 3
  • 0
  • 0
  • 1
  • about 7 years ago
  • October 23, 2017
License

MIT License

Links
Synced at

Mon, 18 Nov 2024 02:45:17 GMT

Languages