Class: ActiveSupport::Cache::SynchronizedMemoryStore
- Inherits:
-
MemoryStore
- Object
- Store
- MemoryStore
- ActiveSupport::Cache::SynchronizedMemoryStore
- Defined in:
- lib/active_support/cache/synchronized_memory_store.rb
Overview
Like MemoryStore, but thread-safe.
Instance Attribute Summary
Attributes inherited from Store
Instance Method Summary collapse
- #clear ⇒ Object
- #decrement(key, amount = 1) ⇒ Object
- #delete(name, options = nil) ⇒ Object
- #delete_matched(matcher, options = nil) ⇒ Object
- #exist?(name, options = nil) ⇒ Boolean
- #fetch(key, options = {}) ⇒ Object
- #increment(key, amount = 1) ⇒ Object
-
#initialize ⇒ SynchronizedMemoryStore
constructor
A new instance of SynchronizedMemoryStore.
- #read(name, options = nil) ⇒ Object
- #write(name, value, options = nil) ⇒ Object
Methods inherited from MemoryStore
Methods inherited from Store
Constructor Details
#initialize ⇒ SynchronizedMemoryStore
Returns a new instance of SynchronizedMemoryStore.
5 6 7 8 |
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 5 def initialize super @guard = Monitor.new end |
Instance Method Details
#clear ⇒ Object
42 43 44 |
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 42 def clear @guard.synchronize { super } end |
#decrement(key, amount = 1) ⇒ Object
38 39 40 |
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 38 def decrement(key, amount = 1) @guard.synchronize { super } end |
#delete(name, options = nil) ⇒ Object
22 23 24 |
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 22 def delete(name, = nil) @guard.synchronize { super } end |
#delete_matched(matcher, options = nil) ⇒ Object
26 27 28 |
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 26 def delete_matched(matcher, = nil) @guard.synchronize { super } end |
#exist?(name, options = nil) ⇒ Boolean
30 31 32 |
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 30 def exist?(name, = nil) @guard.synchronize { super } end |
#fetch(key, options = {}) ⇒ Object
10 11 12 |
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 10 def fetch(key, = {}) @guard.synchronize { super } end |
#increment(key, amount = 1) ⇒ Object
34 35 36 |
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 34 def increment(key, amount = 1) @guard.synchronize { super } end |
#read(name, options = nil) ⇒ Object
14 15 16 |
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 14 def read(name, = nil) @guard.synchronize { super } end |
#write(name, value, options = nil) ⇒ Object
18 19 20 |
# File 'lib/active_support/cache/synchronized_memory_store.rb', line 18 def write(name, value, = nil) @guard.synchronize { super } end |