-
Notifications
You must be signed in to change notification settings - Fork 522
Implement first idea of the cache provider #488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👍 |
Also, Symfony 3.1 will have a Cache component. |
Oh didn't know that, but wouldn't it be better to build against the psr/cache interface? |
I've implemented it in the Drupal module using custom code, without strategy. Code here: https://github.com/drupol/geocoder/blob/8.x-2.x/src/Plugin/Geocoder/Provider.php#L72 |
@Baachi Symfony added the PSR-6 implementation symfony/symfony#17408 :) |
@toin0u Cool didn't know that 👍 |
See #487 if it's only for HTTP request we (php-http) already provide a plugin for caching response with PSR6, this will maybe allow to reduce the maintenance on your side |
@joelwurtz I know that httplug have a caching system but it uses the
If this is possible through httplug, let me know. |
The CachePlugin as an option to respect / ignore cache headers :
In fact the You also give me an idea about introducing a StaleCachePlugin, like caching response in another cache with a longer ttl, and if a following request / response is in failure, it reuse the cached one. |
@joelwurtz This sounds indeed interesting and would also cover this use case.
Yes this is right, but how would you detect if there is an error in this response? Geocoder already know this already and throw an exception if the provider hit the api limit or there is an other error. |
@geocoder-php/geocoder ready for review 👍 |
@Baachi Good job! It looks good 👍 Just few missing phpdocs :) |
👍 |
@Baachi any update on this PR? |
Will try to finish up this PR this week. |
FYI: One could use the CachePlugin to HTTPlug. |
@willdurand do you still want this PR? If yes i will add the missing docs |
Do we need this PR? Doesn't that solve the cache problem for us? |
@Nyholm this is the question, the only thing which isn't currently not covered is the |
I would vote for not merging this and add |
@Nyholm Should i open an issue on the |
I think this implementation looks good. Since it is not too much code, I suggest to open a quick PR and we'll discuss it there. Do not spend too much time (or none) at the tests until you got some feedback. |
Is this PR still needed? |
I think this PR is not needed anymore :) |
Thanks @Baachi 😄 |
Hey guys,
PSR6 has been released weeks ago and so we have a standard for caching. The feature has been wished thousand times so i started to work on it.
Currently this is only a proof of concept and i will finished it if we all fine with the idea.
My intention is currently: We provide multple strategies and the user can decide how he wants to cache the response.
Currently i wrote the stale-if-error strategy and the expire strategy, because i think these are the most common behaviours.
Please provide feedback 😄