geocoder-php / GeocoderLaravel

Geocoder service provider for Laravel
http://geocoder-php.org/GeocoderLaravel/
MIT License
701 stars 102 forks source link

I need to purge the empty cached results, how? #183

Closed adddz closed 2 years ago

adddz commented 3 years ago

As many others already mentioned, the library caches empty results (empty collections). All good up to here, but how can I purge those results?

adddz commented 2 years ago

I guess nobody is maintaining this repo anymore? :(

mikebronner commented 2 years ago

@adddz Sorry for the late reply. Right now to purge those you would do something like php artisan cache:clear.

mikebronner commented 2 years ago

Just released 4.4.5 with the PR that clears items from cache.

adddz commented 2 years ago

Just released 4.4.5 with the PR that clears items from cache.

Hi Mike, thank you so much.

Will this work even for when an address gets assigned latitude and longitude 0.000000?

mikebronner commented 2 years ago

@adddz unfortunately not. It will only remove the empty results. I'll be happy to consider a PR, if you have time to submit one.

adddz commented 2 years ago

@adddz unfortunately not. It will only remove the empty results. I'll be happy to consider a PR, if you have time to submit one.

Sure. Just to understand, let's say the geocoder returns 0.000000 as lat/lng for an address, will it still save it in the cache then? I was thinking of adding a method to the geocoder that removes only a specific item from the cache.

mikebronner commented 2 years ago

I believe that is correct: https://github.com/geocoder-php/GeocoderLaravel/pull/186/files#diff-acda5d354b2c91ce241087f5ae72c8c836de52a45ab812a69f2b5294fe9266c0R322

Perhaps you can add the appropriate logic there, if it makes sense to do so.