Cache sweeping based on age

I’ve written a Rails application of middling complexity that makes use
of Ajax, and at some point, a particular link_to_remote calls an
action that eventually results in nearly 250K worth of generated HTML.
Takes about twenty seconds to do this on my hardware setup, and it’s
unacceptably slow for the purposes of my application. Rough profiling
shows that the main bottleneck in this process is actually the
execution of a complex set of templates, so this would definitely
benefit greatly from caching of some kind.

I’m wondering how to go about expiring the cache though. Here, I have
absolutely no need for any form of that fancy half-observer,
half-filter stuff that goes on in the Caching::Sweeper. All I want to
do is expire the cache after 5 minutes. If any cached page is more
than five minutes old, then basta, regenerate it.

What’s the simplest way to do this?

On Dec 4, 2005, at 9:00 PM, Dido S. wrote:

absolutely no need for any form of that fancy half-observer,
half-filter stuff that goes on in the Caching::Sweeper. All I want to
do is expire the cache after 5 minutes. If any cached page is more
than five minutes old, then basta, regenerate it.

What’s the simplest way to do this?


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

The simplest way is to use a cron job that calls script/runner and
expires the cache. Or even simpler just a cromn job that deletes the
chached files from public/.

Cheers-
-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
[email protected]