Skip to content

Instantly share code, notes, and snippets.

View clemencov's full-sized avatar
🏠
Working from home

Igor Clemencov clemencov

🏠
Working from home
View GitHub Profile
@torkale
torkale / cache_mutex.rb
Created May 21, 2012 12:13
Distributed lock using rails cache
require 'active_support/all'
require 'timeout'
class CacheMutex
INTERVAL = 0.01
TIMEOUT = 20
def initialize(name)
@name = name
@have_lock = false