add caching example

This commit is contained in:
Konstantin Haase 2011-02-21 18:18:35 +01:00
parent 5e13aa8ff4
commit 3690ed3b7c
1 changed files with 15 additions and 0 deletions

View File

@ -1000,6 +1000,21 @@ It is also possible to use a
etag @article.sha1, :weak
These helpers will not do any caching for you, but rather feed the necessary
information to your cache. If you are looking for a quick caching solutions, try
{rack-cache}[http://rtomayko.github.com/rack-cache/]:
require "rack/cache"
require "sinatra"
use Rack::Cache
get '/' do
cache_control :public, :max_age => 36000
sleep 5
"hello"
end
=== Sending Files
For sending files, you can use the <tt>send_file</tt> helper method: