Dont expire or read fragments if caching is turned off

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1270 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson
2005-05-02 07:49:55 +00:00
parent 577a22c47e
commit 1edb807aff

View File

@@ -276,6 +276,8 @@ module ActionController #:nodoc:
end
def write_fragment(name, content, options = {})
return unless perform_caching
key = fragment_cache_key(name)
fragment_cache_store.write(key, content, options)
logger.info "Cached fragment: #{key}" unless logger.nil?
@@ -283,6 +285,8 @@ module ActionController #:nodoc:
end
def read_fragment(name, options = {})
return unless perform_caching
key = fragment_cache_key(name)
if cache = fragment_cache_store.read(key, options)
logger.info "Fragment hit: #{key}" unless logger.nil?
@@ -297,6 +301,8 @@ module ActionController #:nodoc:
# * Hash: Is treated as an implicit call to url_for, like { :controller => "pages", :action => "notes", :id => 45 }
# * Regexp: Will destroy all the matched fragments, example: %r{pages/\d*/notes}
def expire_fragment(name, options = {})
return unless perform_caching
key = fragment_cache_key(name)
if key.is_a?(Regexp)