From 6c955acd137ddc4cb6d90aa0d95abfed042b7006 Mon Sep 17 00:00:00 2001 From: Abrar Ahmad Date: Thu, 1 Dec 2022 14:58:13 +0500 Subject: [PATCH] CacheService class as singleton --- src/Bootstrappers/PrefixCacheTenancyBootstrapper.php | 2 +- tests/PrefixCacheBootstrapperTest.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bootstrappers/PrefixCacheTenancyBootstrapper.php b/src/Bootstrappers/PrefixCacheTenancyBootstrapper.php index cb14fc05..de4346a1 100644 --- a/src/Bootstrappers/PrefixCacheTenancyBootstrapper.php +++ b/src/Bootstrappers/PrefixCacheTenancyBootstrapper.php @@ -40,7 +40,7 @@ class PrefixCacheTenancyBootstrapper implements TenancyBootstrapper { $this->config->set('cache.prefix', $prefix); - // $this->app['cache']->forgetDriver($this->storeName); + $this->app['cache']->forgetDriver($this->storeName); // The CacheManager will have the $app['config'] array cached with old prefixes on the 'cache' instance // This call will forget the 'cache' instance diff --git a/tests/PrefixCacheBootstrapperTest.php b/tests/PrefixCacheBootstrapperTest.php index 13eeeaf9..4c0c7528 100644 --- a/tests/PrefixCacheBootstrapperTest.php +++ b/tests/PrefixCacheBootstrapperTest.php @@ -122,6 +122,8 @@ test('cache base prefix is customizable', function () { }); test('prefix separate cache well enough using CacheManager dependency injection', function () { + $this->app->singleton(CacheAction::class); + app()->make(CacheAction::class)->handle(); expect(cache('key'))->toBe('central-value');