From a65f6806fb8252bf4d6ab0dd03069bb96b054bce Mon Sep 17 00:00:00 2001 From: Takayasu Oyama <t-oyama@colopl.co.jp> Date: Tue, 21 May 2024 10:37:54 +0900 Subject: [PATCH] fix: authCache needs namespace for each connection (#210) fix/auth-cache-dir # Conflicts: # CHANGELOG.md --- CHANGELOG.md | 6 ++++++ src/SpannerServiceProvider.php | 6 +++--- tests/SpannerServiceProviderTest.php | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d791210..0e0be4c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v7.4.1 (2024-05-21) + +Fixed +- authCache needs namespace for each connection (#210) + + # v7.4.0 (2024-05-13) 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"); } }