Skip to content

Commit

Permalink
clear cache one setaccesstoken
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix committed Oct 12, 2017
1 parent 9c264fc commit 6950cc6
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 15 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

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

## [1.1.0] - 2017-10-12
- Clear Cache on setAccessToken()

## [1.0.0] - 2017-10-06
- change default cache to null
- First stable release
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,11 @@ return [
| use to store it's data. You may also add extra parameters that will
| be passed on setCacheConfig (see docs for google-api-php-client).
|
| WARNING: Don't enable cache if you handling with more than one access token.
| Google itself removed underlying cache library till they can fix the issue.
|
| store parameter: null, file
| Optional parameters: "lifetime", "prefix"
*/

'cache' => [
'store' => null,
'store' => file,
],

/*
Expand Down
6 changes: 1 addition & 5 deletions config/search-console.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,11 @@
| use to store it's data. You may also add extra parameters that will
| be passed on setCacheConfig (see docs for google-api-php-client).
|
| WARNING: Don't enable cache if you handling with more than one access token.
| Google itself removed underlying cache library till they can fix the issue.
|
| store parameter: null, file
| Optional parameters: "lifetime", "prefix"
*/

'cache' => [
'store' => null,
'store' => 'file',
],

/*
Expand Down
2 changes: 2 additions & 0 deletions src/SearchConsole.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public function setAccessToken(string $accessToken)
{
$this->client->setAccessToken($accessToken);

$this->client->getGoogleClient()->getCache()->clear();

return $this;
}

Expand Down
3 changes: 0 additions & 3 deletions src/SearchConsoleClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ public static function createAuthenticatedGoogleClient(array $config): Google_Cl
*/
protected static function configureCache(Google_Client $client, $config)
{
if (is_null($config['store'])) {
return;
}
$config = collect($config);

$store = \Cache::store($config->get('store'));
Expand Down
4 changes: 2 additions & 2 deletions src/SearchConsoleServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ public function register()

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

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

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

$client = app(SearchConsoleClient::class);
Expand Down

0 comments on commit 6950cc6

Please sign in to comment.