The homepage of my application has time sensitive data. The homepage is cached for fast loading. However I clean out the cache every day midnight. It means the first person who hits the after the cache clean up has to wait extra long. The cache is cleaned out using a rake job. Is there a way I could write a rake job to just go and hit the homepage and generate the cache page just after the cache is cleaned out. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Raj Singh wrote:> The homepage of my application has time sensitive data. The homepage is > cached for fast loading. > > However I clean out the cache every day midnight. It means the first > person > who hits the after the cache clean up has to wait extra long. > > The cache is cleaned out using a rake job. Is there a way I could write > a > rake job to just go and hit the homepage and generate the cache page > just > after the cache is cleaned out.create the task to run in the correct order (after the cache is cleaned out) and put in a dependency to run the following ruby-code require ''net/http'' Net::HTTP.get_print ''www.my-rails-domain.com'', ''/'' ...would this work? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
That would work, However I would suggest a different approach, consider looking at CRON if your on a linux computer and adding the rake task to the cron tab. This will run rake at certian time intervals and will work even after a restart. Most shared hosts allow you to run cron tasks. On Jul 15, 5:29 pm, Shai Rosenfeld <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Raj Singh wrote: > > The homepage of my application has time sensitive data. The homepage is > > cached for fast loading. > > > However I clean out the cache every day midnight. It means the first > > person > > who hits the after the cache clean up has to wait extra long. > > > The cache is cleaned out using a rake job. Is there a way I could write > > a > > rake job to just go and hit the homepage and generate the cache page > > just > > after the cache is cleaned out. > > create the task to run in the correct order (after the cache is cleaned > out) and put in a dependency to run the following ruby-code > > require ''net/http'' > Net::HTTP.get_print ''www.my-rails-domain.com'', ''/'' > > ...would this work? > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---