Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4622

Problematic caching with rack cache

$
0
0

I am trying to cache a response from a server locally per example shown here.

#!/usr/bin/env rubyrequire 'restclient/components'require 'rack/cache'RestClient.enable Rack::Cache,                  :metastore => 'file:/tmp/cache/meta',                  :entitystore => 'file:/tmp/cache/body',                  :verbose => trueRestClient.get 'http://www.google.com/intl/en/policies/privacy/?fg=1'

Somehow I always get miss as a response and the folder is empty. I guess caching doesn't work for me. What am I doing wrong?

cache: [GET /intl/en/policies/privacy/?fg=1] miss

Update

The response header contains:

Cache-Control: must-revalidate, private, max-age=0 

So I guess my question is how to intercept a response before it is processed and modify the response header fields?


Viewing all articles
Browse latest Browse all 4622


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>