From be10e9647481df49753458e6bae64769c45b922f Mon Sep 17 00:00:00 2001 From: Takayasu Oyama Date: Tue, 21 May 2024 10:37:54 +0900 Subject: [PATCH] fix: authCache needs namespace for each connection (#210) fix/auth-cache-dir --- CHANGELOG.md | 3 +++ src/SpannerServiceProvider.php | 6 +++--- tests/SpannerServiceProviderTest.php | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ebf0f99..9e6dd30e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/SpannerServiceProvider.php b/src/SpannerServiceProvider.php index 41c1ff9f..a821e3c5 100644 --- a/src/SpannerServiceProvider.php +++ b/src/SpannerServiceProvider.php @@ -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']); } /** @@ -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'], ); } diff --git a/tests/SpannerServiceProviderTest.php b/tests/SpannerServiceProviderTest.php index 0103464e..6d1b3a7f 100644 --- a/tests/SpannerServiceProviderTest.php +++ b/tests/SpannerServiceProviderTest.php @@ -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"); } }