This project is archived and is in readonly mode.
Allow sweepers to run expire_fragment without declaring cache_sweeper
-
Marcel Jackwerth
Just ran across the same problem - most websites are describing how to use the Sweeper as an observer (which makes sense, since @@@class Sweeper < ActiveRecord::Observer@@@) but additionally the Sweeper requires a request which went through a controller before hand. It's definately not intuitive. Workers and other deamons (which do not rely on a controller) won't be able to swipe the caches.
I use the following workaround in my Sweepers to make them cache-aware. Works with 2.3.2 but might cause issues sooner or later.
delegate :cache_configured?, :cache_store, :to => ActionController::Base def perform_action; true; end def render; true; end def self.logger ActionController::Base.logger end include ActionController::Benchmarking include ActionController::Caching::FragmentsI wouldn't use these Sweepers in your controllers then anymore.
-
Santiago Pastorino
- State changed from new to open
- Importance changed from to
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino
- State changed from open to stale