mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
add caching example
This commit is contained in:
parent
5e13aa8ff4
commit
3690ed3b7c
1 changed files with 15 additions and 0 deletions
15
README.rdoc
15
README.rdoc
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue