Class: ResqueAdmin::Scheduler::Lock::Basic
- Defined in:
- lib/resque_admin/scheduler/lock/basic.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#initialize, #release, #release!, #value
Constructor Details
This class inherits a constructor from ResqueAdmin::Scheduler::Lock::Base
Instance Method Details
#acquire! ⇒ Object
8 9 10 11 12 13 |
# File 'lib/resque_admin/scheduler/lock/basic.rb', line 8 def acquire! if ResqueAdmin.redis.setnx(key, value) extend_lock! true end end |
#locked? ⇒ Boolean
15 16 17 18 19 20 21 22 23 |
# File 'lib/resque_admin/scheduler/lock/basic.rb', line 15 def locked? if ResqueAdmin.redis.get(key) == value extend_lock! return true if ResqueAdmin.redis.get(key) == value end false end |