document cache_control

This commit is contained in:
Konstantin Haase 2011-02-20 15:55:12 +01:00
parent 1996436204
commit 267579c8ee
1 changed files with 17 additions and 0 deletions

View File

@ -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: