1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

document cache_control

This commit is contained in:
Konstantin Haase 2011-02-20 15:55:12 +01:00
parent 1996436204
commit 267579c8ee

View file

@ -916,6 +916,23 @@ Or use a session:
session[:secret] session[:secret]
end 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 === Sending Files
For sending files, you can use the <tt>send_file</tt> helper method: For sending files, you can use the <tt>send_file</tt> helper method: