# Page Caching with clusters and redirect

**URL:** <https://www.ruby-forum.com/t/page-caching-with-clusters-and-redirect/89488>\
**Category:** Rails\
**Created:** [March 20, 2007, 8:31pm UTC](https://www.ruby-forum.com/t/page-caching-with-clusters-and-redirect/89488 "2007-03-20T20:31:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertjames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9c0ed/32.png) [@robertjames](https://www.ruby-forum.com/u/robertjames)\
**Post date:** [March 20, 2007, 8:31pm UTC](https://www.ruby-forum.com/t/page-caching-with-clusters-and-redirect/89488/1 "2007-03-20T20:31:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![robertjames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9c0ed/32.png) [@robertjames](https://www.ruby-forum.com/u/robertjames)\
**Post date:** [March 21, 2007, 2:17am UTC](https://www.ruby-forum.com/t/page-caching-with-clusters-and-redirect/89488/2 "2007-03-21T02:17:13Z")

</div>

On Mar 21, 3:30 am, “S. Robert J.” [removed\_email\_address@domain.invalid](mailto: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.
