From e5658fa300d36ef825deac5db8c9ed1538c98ef1 Mon Sep 17 00:00:00 2001 From: Abrar Ahmad Date: Tue, 22 Nov 2022 11:32:23 +0500 Subject: [PATCH] cache prefix base from config --- assets/config.php | 1 + src/Bootstrappers/PrefixCacheTenancyBootstrapper.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/config.php b/assets/config.php index b76a666a..609a66f1 100644 --- a/assets/config.php +++ b/assets/config.php @@ -188,6 +188,7 @@ return [ */ 'cache' => [ 'tag_base' => 'tenant', // This tag_base, followed by the tenant_id, will form a tag that will be applied on each cache call. + 'prefix_base' => 'tenant_' // this prefix_base, followed by the tenant_id, will form a cache prefix that will be applied on each cache call ], /** diff --git a/src/Bootstrappers/PrefixCacheTenancyBootstrapper.php b/src/Bootstrappers/PrefixCacheTenancyBootstrapper.php index d409cce8..de4bf1af 100644 --- a/src/Bootstrappers/PrefixCacheTenancyBootstrapper.php +++ b/src/Bootstrappers/PrefixCacheTenancyBootstrapper.php @@ -25,7 +25,7 @@ class PrefixCacheTenancyBootstrapper implements TenancyBootstrapper $this->originalPrefix = $this->app['config']['cache.prefix']; $this->storeName = $this->app['config']['cache.default']; - $this->setCachePrefix('tenant_id_' . $tenant->id); + $this->setCachePrefix($this->app['config']['tenancy.cache.prefix_base'] . $tenant->id); } public function revert(): void