vendor/rails/activesupport/lib/active_support/cache/memory_store.rb in radiant-0.7.2 vs vendor/rails/activesupport/lib/active_support/cache/memory_store.rb in radiant-0.8.0
- old
+ new
@@ -1,7 +1,21 @@
module ActiveSupport
module Cache
+ # 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.
class MemoryStore < Store
def initialize
@data = {}
end
@@ -10,11 +24,11 @@
@data[name]
end
def write(name, value, options = nil)
super
- @data[name] = value
+ @data[name] = value.freeze
end
def delete(name, options = nil)
super
@data.delete(name)
@@ -33,6 +47,6 @@
def clear
@data.clear
end
end
end
-end
\ No newline at end of file
+end