Skip to content

Commit 6950cc6

Browse files
author
Felix
committed
clear cache one setaccesstoken
1 parent 9c264fc commit 6950cc6

File tree

6 files changed

+9
-15
lines changed

6 files changed

+9
-15
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
All Notable changes to `laravel-search-console` will be documented in this file.
44

5+
## [1.1.0] - 2017-10-12
6+
- Clear Cache on setAccessToken()
7+
58
## [1.0.0] - 2017-10-06
69
- change default cache to null
710
- First stable release

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,11 @@ return [
9696
| use to store it's data. You may also add extra parameters that will
9797
| be passed on setCacheConfig (see docs for google-api-php-client).
9898
|
99-
| WARNING: Don't enable cache if you handling with more than one access token.
100-
| Google itself removed underlying cache library till they can fix the issue.
101-
|
102-
| store parameter: null, file
10399
| Optional parameters: "lifetime", "prefix"
104100
*/
105101

106102
'cache' => [
107-
'store' => null,
103+
'store' => file,
108104
],
109105

110106
/*

config/search-console.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,11 @@
4747
| use to store it's data. You may also add extra parameters that will
4848
| be passed on setCacheConfig (see docs for google-api-php-client).
4949
|
50-
| WARNING: Don't enable cache if you handling with more than one access token.
51-
| Google itself removed underlying cache library till they can fix the issue.
52-
|
53-
| store parameter: null, file
5450
| Optional parameters: "lifetime", "prefix"
5551
*/
5652

5753
'cache' => [
58-
'store' => null,
54+
'store' => 'file',
5955
],
6056

6157
/*

src/SearchConsole.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public function setAccessToken(string $accessToken)
4141
{
4242
$this->client->setAccessToken($accessToken);
4343

44+
$this->client->getGoogleClient()->getCache()->clear();
45+
4446
return $this;
4547
}
4648

src/SearchConsoleClientFactory.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ public static function createAuthenticatedGoogleClient(array $config): Google_Cl
4545
*/
4646
protected static function configureCache(Google_Client $client, $config)
4747
{
48-
if (is_null($config['store'])) {
49-
return;
50-
}
5148
$config = collect($config);
5249

5350
$store = \Cache::store($config->get('store'));

src/SearchConsoleServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ public function register()
3030

3131
$searchConsoleConfig = config('search-console');
3232

33-
$this->app->singleton(SearchConsoleClient::class, function () use ($searchConsoleConfig) {
33+
$this->app->bind(SearchConsoleClient::class, function () use ($searchConsoleConfig) {
3434
return SearchConsoleClientFactory::createForConfig($searchConsoleConfig);
3535
});
3636

37-
$this->app->singleton(SearchConsole::class, function () use ($searchConsoleConfig) {
37+
$this->app->bind(SearchConsole::class, function () use ($searchConsoleConfig) {
3838
$this->guardAgainstInvalidConfiguration($searchConsoleConfig);
3939

4040
$client = app(SearchConsoleClient::class);

0 commit comments

Comments
 (0)