Improve ProviderCache
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
Research direction
Start with src/Provider/Cache/ProviderCache.php, especially the cache write around lines 65–66, and trace how Chain returns an empty ArrayCollection after provider exceptions. Define how the proposed isAllowEmptyResult option should affect caching, then verify that empty results are skipped by default and stored when the option permits them.
Written by the indexing model from the issue text.
Description
What are you think about add to ProviderCache flag isAllowEmptyResult?
For example:
$chain = new \Geocoder\Provider\Chain\Chain([
// ...
]);
$cache = new \Geocoder\Provider\Cache\ProviderCache($chain, $cache, 86400);
When have exceptions from providers the chain catch and return empty ArrayCollection.
This result is saved for 24h. I think will be good point if I don't save empty results.
Here is example how I think can be:
$result = $this->realProvider->geocodeQuery($query);
if (!$result->isEmpty() || $this->isAllowEmptyResult)) {
$this->cache->set($cacheKey, $result, $this->lifetime);
}
What are you think about it?
- Dominant language
- PHP
- Stars
- 4k
- Forks
- 525
- Avg merge
- 8m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from geocoder-php/Geocoder
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
geocoder-php/Geocoder#1272 ·
-
question
Difficulty 4/5 3-5 days Newbie friendliness 25/100
geocoder-php/Geocoder#1267 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
geocoder-php/Geocoder#1266 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 38/100
geocoder-php/Geocoder#1244 · 2 comments · 2 reactions ·
-
provider
Difficulty 4/5 3-5 days Newbie friendliness 30/100
geocoder-php/Geocoder#1243 ·
All issues in geocoder-php/Geocoder
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
pluginsGLPI/datainjection#673 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
octobercms/october#6130 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
getgrav/grav-plugin-form#656 ·
-
customer-support needs-triage Platform(Default)
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
sync-en
Difficulty 1/5 1-3 hours Newbie friendliness 88/100