Gotchas

The default TTL for most actions is set to 0, since for most cases
you'll probably want to be fairly explicit about what pages do get
cached by varnish. The default cache header is typically:

Cache-Control: max-age=0, no-cache, private

This is good for normal controller actions, since you won't want to
cache them. If TTL for an action is set to 0, it won't mess with the
default header.

The key gotcha here is that cached pages strip cookies, so if your
application relies on sessions and uses authenticity tokens, the user will
need a session cookie set before form actions will work. Setting default
TTL to 0 here will make sure these session cookies won't break.

As a result, all you have to do to set a cacheable action is the before
filter above.

Note on Patches/Pull Requests

Fork the project.

Make your feature addition or bug fix.

Add tests for it. This is important so I don't break it in a future
version unintentionally.

Commit, do not mess with rakefile, version, or history. (if you want to
have your own version, that is fine but bump version in a commit by itself
I can ignore when I pull)