1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 17:24:03 +00:00

Add cache manager config key

This commit is contained in:
lukinovec 2023-04-17 18:06:29 +02:00
parent ca907e68be
commit ab92f85b51
2 changed files with 6 additions and 4 deletions

View file

@ -2,6 +2,7 @@
declare(strict_types=1);
use Stancl\Tenancy\CacheManager;
use Stancl\Tenancy\Middleware;
use Stancl\Tenancy\Resolvers;
@ -189,6 +190,7 @@ return [
* You can clear cache selectively by specifying the tag.
*/
'cache' => [
'manager' => CacheManager::class,
'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 used for every cache key.
],

View file

@ -96,10 +96,6 @@ class TenancyServiceProvider extends ServiceProvider
return new Commands\MigrateFreshOverride;
});
$this->app->singleton('cache', function ($app) {
return new TenantCacheManager($app);
});
$this->publishes([
__DIR__ . '/../assets/config.php' => config_path('tenancy.php'),
], 'config');
@ -138,5 +134,9 @@ class TenancyServiceProvider extends ServiceProvider
return $instance;
});
$this->app->singleton('cache', function ($app) {
return new $this->app['config']['tenancy.cache.manager']($app);
});
}
}