Skip to content

Commit

Permalink
document cache_control
Browse files Browse the repository at this point in the history
  • Loading branch information
rkh committed Feb 20, 2011
1 parent 1996436 commit 267579c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,23 @@ Or use a session:
session[:secret]
end

=== Cache Control

Setting your headers correctly is the foundation for proper HTTP caching.

You can easily set the Cache-Control header with like this:

get '/' do
cache_control :public
"cache it!"
end

Pro tip: Set up caching in a before filter.

before do
cache_control :public, :must_revalidate, :max_age => 60
end

=== Sending Files

For sending files, you can use the <tt>send_file</tt> helper method:
Expand Down

0 comments on commit 267579c

Please sign in to comment.