4 5 6 7 8 9 10 11 12 13 14
# File 'lib/istox/helpers/dlm.rb', line 4 def lock(key, timeout = 3600, db) loop do break if ::Istox::RedisBoot.sets(key, 1, {nx: true, px: timeout}, db) end begin yield ensure ::Istox::RedisBoot.del key, db end end