0.0
No release in over a year
Use Redis to establish a lock.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
 Project Readme

High School - a Redis mutex in Ruby and Lua

I had my backpack stolen in high school while I was distracted playing chess. :(

Lesson learned. Keep your stuff safe in your locker.

My loss to high school bullies => your win! :)

Here's a simple Redis based Locker for your stuff.

(Implements the locking strategy from Redis Labs' book about... Redis)

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add high_school

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install high_school

Usage

@locker = HighSchool::Locker.new(my_redis_instance)

@locker.lock(
    "the_name_of_my_lock",
    acquire_timeout: 10.seconds,
    lock_timeout: 1.hour
    ) do

    # keep this code safe from other threads ~~stealing your backpack~~ trampling on.
end

License

The gem is available as open source under the terms of the MIT License.

Feedback

Source code available on Github. Feedback and pull requests are greatly appreciated. Let us know if we can improve this.

From

👋 The folks at Census originally put this together. Have data? We'll sync your data warehouse with your CRM and other apps critical to your team. Interested in what we do? Come work with us.