aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/caching.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller/caching.rb')
-rw-r--r--actionpack/lib/action_controller/caching.rb34
1 files changed, 18 insertions, 16 deletions
diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb
index d784138ebe..7fae4e924d 100644
--- a/actionpack/lib/action_controller/caching.rb
+++ b/actionpack/lib/action_controller/caching.rb
@@ -40,15 +40,27 @@ module ActionController #:nodoc:
autoload :Sweeping, 'action_controller/caching/sweeping'
end
- included do
- @@cache_store = nil
- cattr_reader :cache_store
+ module ConfigMethods
+ def cache_store
+ config.cache_store
+ end
- # Defines the storage option for cached fragments
- def self.cache_store=(store_option)
- @@cache_store = ActiveSupport::Cache.lookup_store(store_option)
+ def cache_store=(store)
+ config.cache_store = ActiveSupport::Cache.lookup_store(store)
end
+ private
+
+ def cache_configured?
+ perform_caching && cache_store
+ end
+ end
+
+ include ConfigMethods
+
+ included do
+ extend ConfigMethods
+
include Pages, Actions, Fragments
include Sweeping if defined?(ActiveRecord)
@@ -56,11 +68,6 @@ module ActionController #:nodoc:
cattr_accessor :perform_caching
end
- module ClassMethods
- def cache_configured?
- perform_caching && cache_store
- end
- end
def caching_allowed?
request.get? && response.status == 200
@@ -75,10 +82,5 @@ module ActionController #:nodoc:
yield
end
end
-
- private
- def cache_configured?
- self.class.cache_configured?
- end
end
end