mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 17:44:04 +00:00
Revert condition in CacheManager to avoid excessive nesting
This commit is contained in:
parent
b41d8d19dc
commit
d3c7fef002
1 changed files with 18 additions and 18 deletions
|
|
@ -19,26 +19,26 @@ class CacheManager extends BaseCacheManager
|
|||
public function __call($method, $parameters)
|
||||
{
|
||||
// todo0 Make PrefixCacheTenancyBootstrapper work with tags
|
||||
if (tenancy()->initialized) {
|
||||
$tags = [config('tenancy.cache.tag_base') . tenant()?->getTenantKey()];
|
||||
|
||||
if ($method === 'tags') {
|
||||
$count = count($parameters);
|
||||
|
||||
if ($count !== 1) {
|
||||
throw new \Exception("Method tags() takes exactly 1 argument. $count passed.");
|
||||
}
|
||||
|
||||
$names = $parameters[0];
|
||||
$names = (array) $names; // cache()->tags('foo') https://laravel.com/docs/9.x/cache#removing-tagged-cache-items
|
||||
|
||||
return $this->store()->tags(array_merge($tags, $names));
|
||||
}
|
||||
|
||||
return $this->store()->tags($tags)->$method(...$parameters);
|
||||
if (! tenancy()->initialized) {
|
||||
return parent::__call($method, $parameters);
|
||||
}
|
||||
|
||||
return parent::__call($method, $parameters);
|
||||
$tags = [config('tenancy.cache.tag_base') . tenant()?->getTenantKey()];
|
||||
|
||||
if ($method === 'tags') {
|
||||
$count = count($parameters);
|
||||
|
||||
if ($count !== 1) {
|
||||
throw new \Exception("Method tags() takes exactly 1 argument. $count passed.");
|
||||
}
|
||||
|
||||
$names = $parameters[0];
|
||||
$names = (array) $names; // cache()->tags('foo') https://laravel.com/docs/9.x/cache#removing-tagged-cache-items
|
||||
|
||||
return $this->store()->tags(array_merge($tags, $names));
|
||||
}
|
||||
|
||||
return $this->store()->tags($tags)->$method(...$parameters);
|
||||
}
|
||||
|
||||
public function refreshStore(string|null $repository = null): void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue