Page Caching with clusters and redirect


#1
  1. What’s the behavior of caches_pages when an action returns a
    redirect?
    I’d like to only cache the page if the action renders, but not cache
    the redirect

  2. Any solution for using caching with a cluster of web servers? The
    sweepers won’t fire on the other web servers


#2

On Mar 21, 3:30 am, “S. Robert J.” removed_email_address@domain.invalid wrote:

  1. What’s the behavior of caches_pages when an action returns a
    redirect?
    I’d like to only cache the page if the action renders, but not cache
    the redirect

It will serve the cached page straight away, no matter what, until the
cache has expired. If you need to do redirects, use action-level
caching with a before_filter.

  1. Any solution for using caching with a cluster of web servers? The
    sweepers won’t fire on the other web servers

One solution is to use action caching everywhere and then use a
central memcached server as your fragment store. Whenever you expire
an action, it’ll get expired on that server.