On Tue, Jul 22, 2008 at 2:23 AM, Joost Baaij <[EMAIL PROTECTED]> 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 content. > > > 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.
You don't need an explicit sleep in worker, it will wait anyways on select(). Also, by "one off", you mean, a worker that starts when on schedule and stops after that, you can use "reload_on_schedule true" in worker. _______________________________________________ Backgroundrb-devel mailing list [email protected] http://rubyforge.org/mailman/listinfo/backgroundrb-devel
