[Backgroundrb-devel] Scheduling one-off tasks
lists at wildgooses.com
Tue Jul 29 10:21:03 EDT 2008
Joost Baaij wrote:
> I am building a Rails website which has content that expires at some
> time in the future.
> Since this content is cached, by the time it expires I would like a
> method to sweep the cache at that time. Since it's based on a date, I
> cannot use the Rails app itself. I could use polling or sweep the
> cache every 5 minutes, but maybe there's a better approach?
> I would like to know if I can use backgroundrb's at/cron-like features
> to schedule one-off execution of a piece of code at a date/time in the
> future. This would be a sweeper that runs at the expires_at time of my
> I realise I can build a worker that goes into a sleep/wait loop until
> the desired time, but that's not really better than polling.
I think one issue is that the backgroundb will loose it's pending tasks
if it's rebooted? Does this cause your app a problem?
Have you considered memcached caching which has time based expiry (could
integrate better). Or I think it's not so hard to wrap the builtin
partial caching to include time based expiration (see some of the
plugins for inspiration, just need to choose a good place to store your
Anyway, feels like although bdrb can do this it might not be the best
More information about the Backgroundrb-devel