Class: ActionController::Caching::Fragments::MemoryStore

Inherits:
Object
  • Object
show all
Defined in:
lib/action_controller/caching.rb

Overview

:nodoc:

Direct Known Subclasses

DRbStore, MemCacheStore

Instance Method Summary collapse

Constructor Details

#initializeMemoryStore

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, options = {}) #: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, options) #:nodoc:
  re = Regexp.new("#{Regexp.escape(options[: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, options = {}) #: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, options = {}) #:nodoc:
  @mutex.synchronize { @data[name] = value }
end