sr (owner)

Revisions

  • 33b546 sr Tue Jul 21 13:02:46 -0700 2009
gist: 151557 Download_button fork
public
Description:
Client side caching for net/http using rack/client and rack/cache
Public Clone URL: git://gist.github.com/151557.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require "rack/client"
require "rack/cache"
require "rack/test"
 
app = Rack::Builder.new {
  use Rack::Cache,
    :verbose => true,
    :metastore => "heap:/",
    :entitystore => "heap:/"
  run Rack::Client
}
 
client = Rack::MockRequest.new(app)
 
2.times {
  puts client.get("http://redbot.org/")["X-Rack-Cache"]
}
 
# outputs:
# miss, store
# fresh