Permalink
Browse files

Make use of config.perform_caching

  • Loading branch information...
1 parent fc22552 commit a618ad358a51beead39eca3bf3ee029b66f34f73 @spastorino spastorino committed with wycats Apr 15, 2010
@@ -52,7 +52,7 @@ def cache_store=(store)
private
def cache_configured?
- perform_caching && cache_store
+ config.perform_caching && cache_store
end
end
@@ -61,7 +61,7 @@ module ClassMethods
# Expires the page that was cached with the +path+ as a key. Example:
# expire_page "/lists/show"
def expire_page(path)
- return unless perform_caching
+ return unless config.perform_caching
path = page_cache_path(path)
instrument_page_cache :expire_page, path do
@@ -72,7 +72,7 @@ def expire_page(path)
# Manually cache the +content+ in the key determined by +path+. Example:
# cache_page "I'm the cached content", "/lists/show"
def cache_page(content, path)
- return unless perform_caching
+ return unless config.perform_caching
path = page_cache_path(path)
instrument_page_cache :write_page, path do
@@ -92,7 +92,7 @@ def cache_page(content, path)
# # cache the index action except for JSON requests
# caches_page :index, :if => Proc.new { |c| !c.request.format.json? }
def caches_page(*actions)
- return unless perform_caching
+ return unless config.perform_caching
options = actions.extract_options!
after_filter({:only => actions}.merge(options)) { |c| c.cache_page }
end
@@ -116,7 +116,7 @@ def instrument_page_cache(name, path)
# Expires the page that was cached with the +options+ as a key. Example:
# expire_page :controller => "lists", :action => "show"
def expire_page(options = {})
- return unless perform_caching
+ return unless config.perform_caching
if options.is_a?(Hash)
if options[:action].is_a?(Array)
@@ -135,7 +135,7 @@ def expire_page(options = {})
# If no options are provided, the requested url is used. Example:
# cache_page "I'm the cached content", :controller => "lists", :action => "show"
def cache_page(content = nil, options = nil)
- return unless perform_caching && caching_allowed
+ return unless config.perform_caching && caching_allowed
path = case options
when Hash
@@ -39,7 +39,7 @@ def cache(name = {}, options = nil, &block)
private
# TODO: Create an object that has caching read/write on it
def fragment_for(name = {}, options = nil, &block) #:nodoc:
- if controller.perform_caching
+ if controller.config.perform_caching
if controller.fragment_exist?(name, options)
controller.read_fragment(name, options)
else

0 comments on commit a618ad3

Please sign in to comment.