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

add caching example

This commit is contained in:
Konstantin Haase 2011-02-21 18:18:35 +01:00
parent 5e13aa8ff4
commit 3690ed3b7c

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: