Skip to content

Commit

Permalink
fix: authCache needs namespace for each connection (#210)
Browse files Browse the repository at this point in the history
fix/auth-cache-dir
  • Loading branch information
taka-oyama authored May 21, 2024
1 parent bf9dc42 commit be10e96
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Added
- Support for `INSERT OR IGNORE` (#207)
- Support adding request timeout at query level (#208)

Fixed
- authCache needs namespace for each connection (#210)

# v8.0.0 (2024-04-11)

Added
Expand Down
6 changes: 3 additions & 3 deletions src/SpannerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ protected function parseConfig(array $config, string $name): array
}

/**
* @param array{ cache_path: string|null } $config
* @param array{ name: string, cache_path: string|null } $config
* @return AdapterInterface
*/
protected function createAuthCache(array $config): AdapterInterface
{
return $this->getCacheAdapter('_auth', $config['cache_path']);
return $this->getCacheAdapter($config['name'] . '_auth', $config['cache_path']);
}

/**
Expand All @@ -123,7 +123,7 @@ protected function createAuthCache(array $config): AdapterInterface
protected function createSessionPool(array $config): SessionPoolInterface
{
return new CacheSessionPool(
$this->getCacheAdapter($config['name'], $config['cache_path']),
$this->getCacheAdapter($config['name'] . '_sessions', $config['cache_path']),
$config['session_pool'],
);
}
Expand Down
2 changes: 2 additions & 0 deletions tests/SpannerServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@ public function test_change_cache_path(): void
$db->connection('main')->query()->select('SELECT 1');

$this->assertDirectoryExists($newPath);
$this->assertDirectoryExists("{$newPath}/main_sessions");
$this->assertDirectoryExists("{$newPath}/main_auth");
}
}

0 comments on commit be10e96

Please sign in to comment.