Closed ryuichi7 closed 5 years ago
Hello, @ryuichi7! This is your first Pull Request that will be reviewed by Ebert, an automatic Code Review service. It will leave comments on this diff with potential issues and style violations found in the code as you push new commits. You can also see all the issues found on this Pull Request on its review page. Please check our documentation for more information.
Ebert has finished reviewing this Pull Request and has found:
You can see more details about this review at https://ebertapp.io/github/plataformatec/faraday-http-cache/pulls/97.
Thanks for your Pull Request but I don't think its a good idea to have a configuration for this, because it will work as a escape hatch to "cache requests as you see fit" and not to be closer to the specs we are trying to follow here.
This is a proposal to add a new configuration option called
:cache_key_callback
which allows customization of thecache_key
by passing aProc
that takes therequest
object as an argument.I've added an example to the
README
for clarity.It seems that in the past, the entire
request
object was passed to the private#cache_key_for
method but was amended to pass only therequest.url
due to issues with cache invalidation which was brought up here: https://github.com/plataformatec/faraday-http-cache/issues/42Because the
request.url
is the only attribute ever used as acache_key
I was wondering if the code here is necessary? I couldn't find any place where theLocation
orContent-Location
header values are used as acache_key
. That's why I removed it, but maybe I'm missing something?Thanks so much!