Class: ActionController::Caching::Fragments::MemoryStore
- Defined in:
- lib/action_controller/caching.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Method Summary collapse
-
#delete(name, options = {}) ⇒ Object
:nodoc:.
-
#delete_matched(matcher, options) ⇒ Object
:nodoc:.
-
#initialize ⇒ MemoryStore
constructor
A new instance of MemoryStore.
-
#read(name, options = {}) ⇒ Object
:nodoc:.
-
#write(name, value, options = {}) ⇒ Object
:nodoc:.
Constructor Details
#initialize ⇒ MemoryStore
Returns a new instance of MemoryStore.
323 324 325 |
# File 'lib/action_controller/caching.rb', line 323 def initialize @data, @mutex = { }, Mutex.new end |
Instance Method Details
#delete(name, options = {}) ⇒ Object
:nodoc:
335 336 337 |
# File 'lib/action_controller/caching.rb', line 335 def delete(name, = {}) #:nodoc: @mutex.synchronize { @data.delete(name) } end |
#delete_matched(matcher, options) ⇒ Object
:nodoc:
339 340 341 |
# File 'lib/action_controller/caching.rb', line 339 def delete_matched(matcher, ) #:nodoc: @mutex.synchronize { @data.delete_if { |k,v| k =~ matcher } } end |
#read(name, options = {}) ⇒ Object
:nodoc:
327 328 329 |
# File 'lib/action_controller/caching.rb', line 327 def read(name, = {}) #:nodoc: @mutex.synchronize { @data[name] } rescue nil end |
#write(name, value, options = {}) ⇒ Object
:nodoc:
331 332 333 |
# File 'lib/action_controller/caching.rb', line 331 def write(name, value, = {}) #:nodoc: @mutex.synchronize { @data[name] = value } end |