1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 21:34:04 +00:00

Add DatabaseCacheBootstrapper docblock

This commit is contained in:
lukinovec 2025-07-22 20:00:56 +02:00
parent d482bb9e2d
commit 52052c807a

View file

@ -9,6 +9,17 @@ use Illuminate\Config\Repository;
use Stancl\Tenancy\Contracts\TenancyBootstrapper; use Stancl\Tenancy\Contracts\TenancyBootstrapper;
use Stancl\Tenancy\Contracts\Tenant; 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 class DatabaseCacheBootstrapper implements TenancyBootstrapper
{ {
public function __construct( public function __construct(