Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3e95ab1

Browse files
committed
Fixed caching to be provider-dependent.
1 parent2cd8813 commit3e95ab1

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
55
##[4.3.4] - 2020-06-21
66
###Fixed
77
- non-caching declaration to only apply to current query.
8+
- caching to take provider into account.
89

910
###Changed
1011
-`getProvider()` method to no longer be deprecated, and instead return the

‎src/ProviderAndDumperAggregator.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ protected function cacheRequest(string $cacheKey, array $queryElements, string $
197197
returncollect($this->aggregator->{$queryType}(...$queryElements));
198198
}
199199

200-
$hashedCacheKey =sha1($cacheKey);
200+
$hashedCacheKey =sha1($this->getProvider()->getName() ."-" .$cacheKey);
201201
$duration =config("geocoder.cache.duration",0);
202202
$store =config('geocoder.cache.store');
203203

‎tests/Feature/Providers/GeocoderServiceTest.php‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ public function testGeocoder()
160160

161161
publicfunctiontestCacheIsUsed()
162162
{
163-
$cacheKey =sha1(Str::slug(strtolower(urlencode('1600 Pennsylvania Ave NW, Washington, DC 20500, USA'))));
163+
$cacheKey =sha1(
164+
app('geocoder')->getProvider()->getName()
165+
."-" . Str::slug(strtolower(urlencode('1600 Pennsylvania Ave NW, Washington, DC 20500, USA')))
166+
);
164167

165168
$result =app('geocoder')
166169
->geocode('1600 Pennsylvania Ave NW, Washington, DC 20500, USA')
@@ -271,7 +274,9 @@ public function testGetProvider()
271274

272275
publicfunctiontestJapaneseCharacterGeocoding()
273276
{
274-
$cacheKey =sha1(Str::slug(strtolower(urlencode('108-0075 東京都港区港南2丁目16-3'))));
277+
$cacheKey =sha1(app('geocoder')->getProvider()->getName()
278+
."-" . Str::slug(strtolower(urlencode('108-0075 東京都港区港南2丁目16-3')))
279+
);
275280

276281
app('geocoder')
277282
->geocode('108-0075 東京都港区港南2丁目16-3')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp