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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community 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
on
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 =>
question.id
    expire_all_recently_added
  end
........
  def expire_all_recently_added
    expire_fragment :controller => 'landing', :action => 'last_added',
:part
=> 'list'
  end
.
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
how
it would be called by script/runner?

Thanks,

Steve
http://www.smarkets.net
This topic is locked and can not be replied to.