diff options
author | Carlhuda <carlhuda@engineyard.com> | 2010-03-04 16:50:57 -0800 |
---|---|---|
committer | Carlhuda <carlhuda@engineyard.com> | 2010-03-04 16:50:57 -0800 |
commit | ff29606c061099f82668ab62e50660cda8645512 (patch) | |
tree | d7da0a6a9c0ba72ce1f9b7f61c3bf0c8442bc5c5 /actionpack/lib/action_controller/caching.rb | |
parent | c8e1cc8657c19a852f3c84cdc61df538486f5adf (diff) | |
download | rails-ff29606c061099f82668ab62e50660cda8645512.tar.gz rails-ff29606c061099f82668ab62e50660cda8645512.tar.bz2 rails-ff29606c061099f82668ab62e50660cda8645512.zip |
Refactor cache_store to use ActionController config
Diffstat (limited to 'actionpack/lib/action_controller/caching.rb')
-rw-r--r-- | actionpack/lib/action_controller/caching.rb | 34 |
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 |