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(re, 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.
303 304 305 |
# File 'lib/action_controller/caching.rb', line 303 def initialize @data, @mutex = { }, Mutex.new end |
Instance Method Details
#delete(name, options = {}) ⇒ Object
:nodoc:
315 316 317 |
# File 'lib/action_controller/caching.rb', line 315 def delete(name, = {}) #:nodoc: @mutex.synchronize { @data.delete(name) } end |
#delete_matched(re, options) ⇒ Object
:nodoc:
319 320 321 |
# File 'lib/action_controller/caching.rb', line 319 def delete_matched(re, ) #:nodoc: @mutex.synchronize { @data.delete_if {|k,v| k.index([:root_path]) == 0 and k =~ re} } end |
#read(name, options = {}) ⇒ Object
:nodoc:
307 308 309 |
# File 'lib/action_controller/caching.rb', line 307 def read(name, = {}) #:nodoc: @mutex.synchronize { @data[name] } rescue nil end |
#write(name, value, options = {}) ⇒ Object
:nodoc:
311 312 313 |
# File 'lib/action_controller/caching.rb', line 311 def write(name, value, = {}) #:nodoc: @mutex.synchronize { @data[name] = value } end |