From b08c96887538cf53670bb882e79996582375e6c9 Mon Sep 17 00:00:00 2001 From: Lourens Naude Date: Sat, 17 Jan 2009 18:05:48 -0600 Subject: Decouple the local cache strategy from MemCacheStore for reuse with other remote stores [#1653 state:resolved] Signed-off-by: Joshua Peek --- railties/lib/initializer.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'railties/lib/initializer.rb') diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index b57c46e098..f6b8899d58 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -414,8 +414,10 @@ Run `rake gems:install` to install the missing gems. def initialize_cache unless defined?(RAILS_CACHE) silence_warnings { Object.const_set "RAILS_CACHE", ActiveSupport::Cache.lookup_store(configuration.cache_store) } - if RAILS_CACHE.class.name == "ActiveSupport::Cache::MemCacheStore" - configuration.middleware.insert_after(:"ActionController::Failsafe", ActiveSupport::Cache::MemCacheStore::LocalCache) + + if RAILS_CACHE.respond_to?(:middleware) + # Insert middleware to setup and teardown local cache for each request + configuration.middleware.insert_after(:"ActionController::Failsafe", RAILS_CACHE.middleware) end end end -- cgit v1.2.3