Forum: Ruby on Rails expiring cache fragments using script/runner

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Steve O. (Guest)
on 2006-05-21 06:42
(Received via mailing list)
I've just set up caching on my site and want to expire some of fragments
an hourly basis.

I was going to use cron and script/runner to do this.

For other fragments that I am expiring, I am using expire_fragment
inside a
sweeper class, something like:

class QuestionSweeper < ActionController::Caching::Sweeper
  observe Question

  def after_validation_on_update(question)
    expire_page :controller => 'xml', :action => 'question', :id =>
  def expire_all_recently_added
    expire_fragment :controller => 'landing', :action => 'last_added',
=> 'list'
What I am stumped on is that I want to use script/runner which works on
models, and expire_fragment which works in controllers.

Can someone provide an example of how they would expire the fragment and
it would be called by script/runner?


This topic is locked and can not be replied to.