Module: FoundersToolkit::Util::Lockable

Extended by:
ActiveSupport::Concern
Defined in:
lib/founders_toolkit/util/lockable.rb

Instance Method Summary collapse

Instance Method Details

#lockerObject



14
15
16
# File 'lib/founders_toolkit/util/lockable.rb', line 14

def locker
  @locker ||= Redlock::Client.new([Redis.new])
end

#with_lock(name, ttl, &block) ⇒ Object



18
19
20
# File 'lib/founders_toolkit/util/lockable.rb', line 18

def with_lock(name, ttl, &block)
  locker.lock!(name, ttl, &block)
end