0

I'm trying to build a fast proxy-ish web server on a raspberry pi. I want it to render my ruby code according to a schedule, then serve the static page to the client (iphone / laptop on local network). I know that rails will cache via

http://guides.rubyonrails.org/caching_with_rails.html#page-caching

So, one solution could be to use cron on the raspberry pi to schedule the cache update...Is there a better way? Can I force rails to update the cache autonomously at certain times of day??

Calvin Flegal
  • 185
  • 1
  • 1
  • 10

1 Answers1

0

Why don't you use :expires_in maybe you can set an amount of time as a period. see more ate: http://guides.rubyonrails.org/caching_with_rails.html#configuration

M.Octavio
  • 1,780
  • 2
  • 25
  • 39
  • It seems to me that would just invalidate the cache but not refresh it until the next request... – Calvin Flegal May 17 '13 at 19:08
  • http://stackoverflow.com/questions/9423511/rails-3-2-pre-render-bake-a-new-page-cache-immediately-after-expiry?rq=1 is close and may be the best we can do – Calvin Flegal May 17 '13 at 19:11
  • Have you tried something like cache.write(key, value, :expires_in => 1.minute) ? not really sure but I think it may work. – M.Octavio May 17 '13 at 19:21