From 267579c8eec16270291a26030700e47ec56a657b Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Sun, 20 Feb 2011 15:55:12 +0100 Subject: [PATCH] document cache_control --- README.rdoc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.rdoc b/README.rdoc index 0d408193..91534731 100644 --- a/README.rdoc +++ b/README.rdoc @@ -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 send_file helper method: