6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/cache_server.rb', line 6
def process(request, response)
Mongrel::PageCacheHandler::Utils.do_work(request, response) do
file_path = Mongrel::PageCacheHandler::Utils.build_cachetastic_key(request)
f = Cachetastic::Caches::PageCache.get(file_path)
if f
puts "We found: #{file_path} in the cache, let's render it"
response.start(200, true) do |head, out|
if file_path =~ /\.xml$/
head["Content-Type"] = "text/xml"
else
head["Content-Type"] = "text/html"
end
out.write(f)
end
end
end
end
|