geocoder-php/BazingaGeocoderBundle

Cache not refreshed when we change the fake_ip value in config

ruano-a opened this issue · 4 comments

bazinga_geocoder:
    fake_ip: 
        local_ip: ::1
        ip: 123.123.123.123
    providers:
        geoPlugin:
            factory: Bazinga\GeocoderBundle\ProviderFactory\GeoPluginFactory
            cache: 'app.simple_cache'
            cache_lifetime: 3600
            cache_precision: ~

In this example, if I change 123.123.123.123 to anything else, the cache is hit and not refreshed.
I assume it's because what GeocodeQuery::create() receives as an argument is the same as before ('127.0.01', or '::1' in my case)

By its nature, it's a dev env issue only.

I think cache invalidation is up to you ;)

Well considering the config, we don't really handle how cache is used or invalidated, we just tell geocoder to use a certain one and that's it. Beside, it shows that the used cache key is the localhost one, and not the fake ip as I think it should be?

Then I think we need to switch the order of plugins to run FakeIpPlugin before CachePlugin. Would you like to contribute?

Here it is #335