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.



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