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.
313 314 315 |
# File 'lib/action_controller/caching.rb', line 313 def initialize @data, @mutex = { }, Mutex.new end |
Instance Method Details
#delete(name, options = {}) ⇒ Object
:nodoc:
325 326 327 |
# File 'lib/action_controller/caching.rb', line 325 def delete(name, = {}) #:nodoc: @mutex.synchronize { @data.delete(name) } end |
#delete_matched(re, options) ⇒ Object
:nodoc:
329 330 331 332 |
# File 'lib/action_controller/caching.rb', line 329 def delete_matched(re, ) #:nodoc: re = Regexp.new("#{Regexp.escape([:root_path])}#{re.source}") @mutex.synchronize { @data.delete_if { |k,v| k =~ re } } end |
#read(name, options = {}) ⇒ Object
:nodoc:
317 318 319 |
# File 'lib/action_controller/caching.rb', line 317 def read(name, = {}) #:nodoc: @mutex.synchronize { @data[name] } rescue nil end |
#write(name, value, options = {}) ⇒ Object
:nodoc:
321 322 323 |
# File 'lib/action_controller/caching.rb', line 321 def write(name, value, = {}) #:nodoc: @mutex.synchronize { @data[name] = value } end |