aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/caching
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-05-20 10:37:30 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-05-20 10:37:30 +0100
commit1148af4b3f8507c851be2f0bee103642937e8c29 (patch)
tree460879f6076f271e7dbc0b313245be6bf1ba640e /actionpack/lib/action_controller/caching
parentecba27c9701698a70eb7a7af1a995bb1d089949c (diff)
parent1b0128c5413ace12dee45e9db328cff866a5bb06 (diff)
downloadrails-1148af4b3f8507c851be2f0bee103642937e8c29.tar.gz
rails-1148af4b3f8507c851be2f0bee103642937e8c29.tar.bz2
rails-1148af4b3f8507c851be2f0bee103642937e8c29.zip
Merge commit 'mainstream/master'
Diffstat (limited to 'actionpack/lib/action_controller/caching')
-rw-r--r--actionpack/lib/action_controller/caching/fragments.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/caching/fragments.rb b/actionpack/lib/action_controller/caching/fragments.rb
index e4d8678a07..e4f5de44ab 100644
--- a/actionpack/lib/action_controller/caching/fragments.rb
+++ b/actionpack/lib/action_controller/caching/fragments.rb
@@ -98,6 +98,17 @@ module ActionController #:nodoc:
end
end
+ # Check if a cached fragment from the location signified by <tt>key</tt> exists (see <tt>expire_fragment</tt> for acceptable formats)
+ def fragment_exist?(key, options = nil)
+ return unless cache_configured?
+
+ key = fragment_cache_key(key)
+
+ self.class.benchmark "Cached fragment exists?: #{key}" do
+ cache_store.exist?(key, options)
+ end
+ end
+
# Name can take one of three forms:
# * String: This would normally take the form of a path like "pages/45/notes"
# * Hash: Is treated as an implicit call to url_for, like { :controller => "pages", :action => "notes", :id => 45 }
@@ -124,4 +135,4 @@ module ActionController #:nodoc:
end
end
end
-end \ No newline at end of file
+end