diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-05-02 07:49:55 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-05-02 07:49:55 +0000 |
commit | 1edb807aff0d0f21cdc36447f7d671e10b542946 (patch) | |
tree | 61c21a789ff85f3760b90a2e16ef7396deccc772 | |
parent | 577a22c47ea43365a81a92fc5ca20dd86c146ba7 (diff) | |
download | rails-1edb807aff0d0f21cdc36447f7d671e10b542946.tar.gz rails-1edb807aff0d0f21cdc36447f7d671e10b542946.tar.bz2 rails-1edb807aff0d0f21cdc36447f7d671e10b542946.zip |
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
-rw-r--r-- | actionpack/lib/action_controller/caching.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb index 7c384738d6..28618e2427 100644 --- a/actionpack/lib/action_controller/caching.rb +++ b/actionpack/lib/action_controller/caching.rb @@ -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) |