From 52052c807a2e018ad72780c6dffd19686abafe93 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Tue, 22 Jul 2025 20:00:56 +0200 Subject: [PATCH] Add DatabaseCacheBootstrapper docblock --- src/Bootstrappers/DatabaseCacheBootstrapper.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Bootstrappers/DatabaseCacheBootstrapper.php b/src/Bootstrappers/DatabaseCacheBootstrapper.php index a1183049..c6e48273 100644 --- a/src/Bootstrappers/DatabaseCacheBootstrapper.php +++ b/src/Bootstrappers/DatabaseCacheBootstrapper.php @@ -9,6 +9,17 @@ use Illuminate\Config\Repository; use Stancl\Tenancy\Contracts\TenancyBootstrapper; use Stancl\Tenancy\Contracts\Tenant; +/** + * This bootstrapper allows cache to be stored in the tenant databases by switching the database cache store's connection. + * Intended to be used with the 'database' cache store, instead of CacheTenancyBootstrapper. + * + * On bootstrap(), the database cache store's connection is set to 'tenant' + * and the database cache store is purged from the CacheManager's resolved stores. + * This forces the manager to resolve a new instance of the database store created with the 'tenant' DB connection on the next cache operation. + * + * On revert, the cache store's connection is reverted to the originally used one (usually 'central'), and again, + * the database cache store is purged from the CacheManager's resolved stores so that the originally used one is resolved on the next cache operation. + */ class DatabaseCacheBootstrapper implements TenancyBootstrapper { public function __construct(