RailsCasts Pro episodes are now free!

Learn more or hide this

Xavier Noria's Profile

GitHub User: fxn

Site: http://www.hashref.com

Comments by Xavier Noria


@Ryan in HTTP caching you can only fix expiration once.

So, if you set a TTL of 30 minutes for a page, you're done. No way to tell the users and intermediate proxy caches that fetched that one they need to revalidate right now because it is stale. They won't do it after 30 minutes have passed.

So, the key of this approach vs HTTP headers is that you have total control over the expiration of the cache.


Just a comment about the call to rm_rf.

Doing a recursive rm is not atomic and weird things may happen if at the same time you get requests that are generating files again in the same tree.

In order to safely expire an entire directory it is better to move it. Moving a directory is atomic. After moving you can rm_rf safely.