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.



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, options = {}) #: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, options) #:nodoc:
  @mutex.synchronize { @data.delete_if {|k,v| k.index(options[: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, options = {}) #: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, options = {}) #:nodoc:
  @mutex.synchronize { @data[name] = value }
end