Forum: Ruby on Rails Cache sweeping based on age

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.
dido.sevilla (Guest)
on 2005-12-05 07:04
(Received via mailing list)
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?
ezra (Guest)
on 2005-12-05 19:35
(Received via mailing list)
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
> removed_email_address@domain.invalid
> 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
removed_email_address@domain.invalid
This topic is locked and can not be replied to.