A cache store implementation which stores everything into memory in the same process. If you're running multiple Ruby on Rails server processes (which is the case if you're using mongrel_cluster or Phusion Passenger), then this means that your Rails server process instances won't be able to share cache data with each other. If your application never performs manual cache item expiry (e.g. when you're using generational cache keys), then using MemoryStore is ok. Otherwise, consider carefully whether you should be using this cache store.

MemoryStore is not only able to store strings, but also arbitrary Ruby objects.

MemoryStore is not thread-safe. Use SynchronizedMemoryStore instead if you need thread-safety.

Methods
C
D
E
N
R
W
Class Public methods
new()
# File activesupport/lib/active_support/cache/memory_store.rb, line 18
def initialize
  @data = {}
end
Instance Public methods
clear()
# File activesupport/lib/active_support/cache/memory_store.rb, line 53
def clear
  @data.clear
end
delete(name, options = nil)
# File activesupport/lib/active_support/cache/memory_store.rb, line 38
def delete(name, options = nil)
  super
  @data.delete(name)
end
delete_matched(matcher, options = nil)
# File activesupport/lib/active_support/cache/memory_store.rb, line 43
def delete_matched(matcher, options = nil)
  super
  @data.delete_if { |k,v| k =~ matcher }
end
exist?(name, options = nil)
# File activesupport/lib/active_support/cache/memory_store.rb, line 48
def exist?(name, options = nil)
  super
  @data.has_key?(name)
end
read(name, options = nil)
# File activesupport/lib/active_support/cache/memory_store.rb, line 28
def read(name, options = nil)
  super
  @data[name]
end
read_multi(*names)
# File activesupport/lib/active_support/cache/memory_store.rb, line 22
def read_multi(*names)
  results = {}
  names.each { |n| results[n] = read(n) }
  results
end
write(name, value, options = nil)
# File activesupport/lib/active_support/cache/memory_store.rb, line 33
def write(name, value, options = nil)
  super
  @data[name] = value.freeze
end