1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 18:34:04 +00:00

Check cache store support for tags

This commit is contained in:
Mohamed Gamil 2021-07-08 12:34:06 +02:00
parent 1a5300ab4f
commit aa7291ba05

View file

@ -18,6 +18,7 @@ class CacheManager extends BaseCacheManager
public function __call($method, $parameters)
{
$tags = [config('tenancy.cache.tag_base') . tenant()->getTenantKey()];
$supportTags = $this->store()->getStore() instanceof \Illuminate\Cache\TaggableStore;
if ($method === 'tags') {
if (count($parameters) !== 1) {
@ -30,6 +31,8 @@ class CacheManager extends BaseCacheManager
return $this->store()->tags(array_merge($tags, $names));
}
return $this->store()->tags($tags)->$method(...$parameters);
return $supportTags
? $this->store()->tags($tags)->$method(...$parameters)
: $this->store()->$method(...$parameters);
}
}