{"action":"created","issue":{"url":"https://api.github.com/repos/plataformatec/faraday-http-cache/issues/86","repository_url":"https://api.github.com/repos/plataformatec/faraday-http-cache","labels_url":"https://api.github.com/repos/plataformatec/faraday-http-cache/issues/86/labels{/name}","comments_url":"https://api.github.com/repos/plataformatec/faraday-http-cache/issues/86/comments","events_url":"https://api.github.com/repos/plataformatec/faraday-http-cache/issues/86/events","html_url":"https://github.com/plataformatec/faraday-http-cache/pull/86","id":150563612,"number":86,"title":"store option support storage instance","user":{"login":"vkill","id":610852,"avatar_url":"https://avatars.githubusercontent.com/u/610852?v=3","gravatar_id":"","url":"https://api.github.com/users/vkill","html_url":"https://github.com/vkill","followers_url":"https://api.github.com/users/vkill/followers","following_url":"https://api.github.com/users/vkill/following{/other_user}","gists_url":"https://api.github.com/users/vkill/gists{/gist_id}","starred_url":"https://api.github.com/users/vkill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkill/subscriptions","organizations_url":"https://api.github.com/users/vkill/orgs","repos_url":"https://api.github.com/users/vkill/repos","events_url":"https://api.github.com/users/vkill/events{/privacy}","received_events_url":"https://api.github.com/users/vkill/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-23T15:09:52Z","updated_at":"2016-04-23T17:48:56Z","closed_at":"2016-04-23T16:55:47Z","pull_request":{"url":"https://api.github.com/repos/plataformatec/faraday-http-cache/pulls/86","html_url":"https://github.com/plataformatec/faraday-http-cache/pull/86","diff_url":"https://github.com/plataformatec/faraday-http-cache/pull/86.diff","patch_url":"https://github.com/plataformatec/faraday-http-cache/pull/86.patch"},"body":"Hi\r\n\r\nSome times, we request url is like `http://example.com/users/3?access_token=xxxxxx`, and we want cache it. Now, The default cache_key is the full url(include ?access_token=xxxxxx).\r\n\r\nSo, I make a subclass for Storage, and override cache_key_for method, and use it like this\r\n```ruby\r\nmodule Faraday\r\n  class HttpCache\r\n    class MyStorage < Storage\r\n      def cache_key_for(url)\r\n        uri = URI.parse(url.to_s)\r\n        params = Rack::Utils.parse_query(uri.query)\r\n        params = params.except('access_token')\r\n        uri.query = params.to_query\r\n\r\n        super uri\r\n      end\r\n    end\r\n  end\r\nend\r\n\r\nstore = Faraday::HttpCache::MyStorage.new(store: Rails.cache)\r\n\r\nclient = Faraday.new do |builder|\r\n  builder.use :http_cache, store: store\r\n  builder.adapter Faraday.default_adapter\r\nend\r\n```\r\n\r\nBut it does not working.\r\n\r\nSo, I make a PR to solve it.\r\n\r\nPlease review it. thanks.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/plataformatec/faraday-http-cache/issues/comments/213796297","html_url":"https://github.com/plataformatec/faraday-http-cache/pull/86#issuecomment-213796297","issue_url":"https://api.github.com/repos/plataformatec/faraday-http-cache/issues/86","id":213796297,"user":{"login":"vkill","id":610852,"avatar_url":"https://avatars.githubusercontent.com/u/610852?v=3","gravatar_id":"","url":"https://api.github.com/users/vkill","html_url":"https://github.com/vkill","followers_url":"https://api.github.com/users/vkill/followers","following_url":"https://api.github.com/users/vkill/following{/other_user}","gists_url":"https://api.github.com/users/vkill/gists{/gist_id}","starred_url":"https://api.github.com/users/vkill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkill/subscriptions","organizations_url":"https://api.github.com/users/vkill/orgs","repos_url":"https://api.github.com/users/vkill/repos","events_url":"https://api.github.com/users/vkill/events{/privacy}","received_events_url":"https://api.github.com/users/vkill/received_events","type":"User","site_admin":false},"created_at":"2016-04-23T17:48:56Z","updated_at":"2016-04-23T17:48:56Z","body":"oh, I see.\r\n"}}