Class: Juno::Lock
Overview
Locks the underlying stores with a Mutex
Instance Attribute Summary
Attributes inherited from Proxy
Instance Method Summary collapse
- #clear(options = {}) ⇒ Object
- #close ⇒ Object
- #delete(key, options = {}) ⇒ Object
-
#initialize(adapter, options = {}) ⇒ Lock
constructor
Constructor.
- #key?(key, options = {}) ⇒ Boolean
- #load(key, options = {}) ⇒ Object
- #store(key, value, options = {}) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(adapter, options = {}) ⇒ Lock
Constructor
Options:
-
:mutex - Mutex object (default Mutex.new)
14 15 16 17 |
# File 'lib/juno/lock.rb', line 14 def initialize(adapter, = {}) super @lock = [:mutex] || Mutex.new end |
Instance Method Details
#clear(options = {}) ⇒ Object
35 36 37 38 |
# File 'lib/juno/lock.rb', line 35 def clear( = {}) @lock.synchronize { super } self end |
#close ⇒ Object
40 41 42 |
# File 'lib/juno/lock.rb', line 40 def close @lock.synchronize { super } end |
#delete(key, options = {}) ⇒ Object
31 32 33 |
# File 'lib/juno/lock.rb', line 31 def delete(key, = {}) @lock.synchronize { super } end |
#key?(key, options = {}) ⇒ Boolean
19 20 21 |
# File 'lib/juno/lock.rb', line 19 def key?(key, = {}) @lock.synchronize { super } end |
#load(key, options = {}) ⇒ Object
23 24 25 |
# File 'lib/juno/lock.rb', line 23 def load(key, = {}) @lock.synchronize { super } end |
#store(key, value, options = {}) ⇒ Object
27 28 29 |
# File 'lib/juno/lock.rb', line 27 def store(key, value, = {}) @lock.synchronize { super } end |