Skip to content

Instantly share code, notes, and snippets.

@wezm
Created August 12, 2009 07:12
Show Gist options
  • Save wezm/166357 to your computer and use it in GitHub Desktop.
Save wezm/166357 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'rack/cache'
infinity = Proc.new do |env|
# env['HTTP_CACHE_CONTROL'] = 'max-age=60'
[200, {"Content-Type" => "text/plain", 'Cache-Control' => 'max-age=60'}, env.inspect]
end
use Rack::CommonLogger
use Rack::Cache,
:verbose => true,
:metastore => 'file:/tmp/cache-test-m',
:entitystore => 'file:/tmp/cache-text-e'
map '/' do
run infinity
end
map '/version' do
map '/' do
run Proc.new {|env| [200, {"Content-Type" => "text/plain"}, "infinity 0.1"] }
end
map '/last' do
run Proc.new {|env| [200, {"Content-Type" => "text/plain"}, "infinity beta 0.0"] }
end
end
rackup -s mongrel infinity.ru
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment