-
Notifications
You must be signed in to change notification settings - Fork 106
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
Localization solution avoids caching #159
Comments
Thanks, I will look into this. Can you provide an example that I can use as a test-case? |
First implementation
but it doesn't affect the query result, indeed
That behavior would probably deserve a specific issue ticket (???). As you can see, I configured caching on Redis and it successfully work. Second implementation
and finally I get a localized result:
The side effect of this implementation is that the result won't be cached. I'm not sure but I think it's something concerning the
|
Run into this today i can confirm that since the ProviderAndDumperAggregator is not used there is no caching layer. Is this the recommended way to localize the results or maybe there is an alternative approach? |
If you are not using the |
Hey thanks for your reply. My use case is pretty simple: Localize the results to the user selected language. The only way that I was able to achieve this was by following the steps described in #131 $cachedProvider = new ProviderCache(
$geocoder->getProvider(),
app('cache')->store(config('geocoder.cache.store')),
config('geocoder.cache.duration')
);
$this->geocoder = new StatefulGeocoder($cachedProvider); Maybe it's worth considering refactoring the caching layer to make use of the ProviderCache? |
I was taking a look at how to implement caching by locale. At this time I don't have a solution yet. My recommendation would be to use |
General Information
GeocoderLaravel Version: latest
Laravel Version: 6.x
PHP Version: 7.2.4
Operating System and Version: Ubuntu 18.04.1
Issue Description
Following the instructions provided by #131 or #128 you can successfully get localized results, but those methods have the side effect of bypassing ProviderAndDumperAggregator and so avoiding geocoding cache.
The text was updated successfully, but these errors were encountered: