[READ-ONLY] Mirror of https://github.com/Schniz/redis_mutex.cr. Distributed mutex in Ruby using Redis for Crystal
0

Configure Feed

Select the types of activity you want to include in your feed.

Crystal 100.0%
8 1 2

Clone this repository

https://tangled.org/schlez.in/redis_mutex.cr https://tangled.org/did:plc:vcny2qvoy673r5gdywyfcp7f
git@tangled.org:schlez.in/redis_mutex.cr git@tangled.org:did:plc:vcny2qvoy673r5gdywyfcp7f

For self-hosted knots, clone URLs may differ based on your setup.



README.md

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