aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschneems <richard.schneeman@gmail.com>2012-09-05 15:51:20 -0700
committerschneems <richard.schneeman@gmail.com>2012-09-05 15:52:24 -0700
commitc9d1ba41fd1195d4aaece2a4fc5c83273bd835bd (patch)
tree339084027befe08b65c86158f27f77a57c7c5898
parent2c96638c70e98058bee29c9f8b9d1d181b9dce9e (diff)
downloadrails-c9d1ba41fd1195d4aaece2a4fc5c83273bd835bd.tar.gz
rails-c9d1ba41fd1195d4aaece2a4fc5c83273bd835bd.tar.bz2
rails-c9d1ba41fd1195d4aaece2a4fc5c83273bd835bd.zip
Doc: sweepers only work on Active Record Models
In response to this rails issue: https://github.com/rails/rails/issues/3729
-rw-r--r--actionpack/lib/action_controller/caching/sweeping.rb2
-rw-r--r--guides/source/caching_with_rails.textile4
2 files changed, 4 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/caching/sweeping.rb b/actionpack/lib/action_controller/caching/sweeping.rb
index 73291ce083..271d5f06b8 100644
--- a/actionpack/lib/action_controller/caching/sweeping.rb
+++ b/actionpack/lib/action_controller/caching/sweeping.rb
@@ -1,6 +1,6 @@
module ActionController #:nodoc:
module Caching
- # Sweepers are the terminators of the caching world and responsible for expiring caches when model objects change.
+ # Sweepers are the terminators of the caching world and responsible for expiring caches when Active Record objects change.
# They do this by being half-observers, half-filters and implementing callbacks for both roles. A Sweeper example:
#
# class ListSweeper < ActionController::Caching::Sweeper
diff --git a/guides/source/caching_with_rails.textile b/guides/source/caching_with_rails.textile
index 9f1ac18814..577596ac0d 100644
--- a/guides/source/caching_with_rails.textile
+++ b/guides/source/caching_with_rails.textile
@@ -173,7 +173,9 @@ expire_fragment('all_available_products')
h4. Sweepers
-Cache sweeping is a mechanism which allows you to get around having a ton of +expire_{page,action,fragment}+ calls in your code. It does this by moving all the work required to expire cached content into an +ActionController::Caching::Sweeper+ subclass. This class is an observer and looks for changes to an object via callbacks, and when a change occurs it expires the caches associated with that object in an around or after filter.
+Cache sweeping is a mechanism which allows you to get around having a ton of +expire_{page,action,fragment}+ calls in your code. It does this by moving all the work required to expire cached content into an +ActionController::Caching::Sweeper+ subclass. This class is an observer and looks for changes to an Active Record object via callbacks, and when a change occurs it expires the caches associated with that object in an around or after filter.
+
+TIP: Sweepers rely on the use of Active Record and Active Record Observers. The object you are observing must be an Active Record model.
Continuing with our Product controller example, we could rewrite it with a sweeper like this: