diff --git a/src/think/Cache.php b/src/think/Cache.php index a2e30b50f0..cbafd27978 100644 --- a/src/think/Cache.php +++ b/src/think/Cache.php @@ -16,6 +16,7 @@ use DateTimeInterface; use Psr\SimpleCache\CacheInterface; use think\cache\Driver; +use think\cache\TagSet; use think\exception\InvalidArgumentException; use think\helper\Arr; @@ -185,4 +186,15 @@ public function has($key): bool return $this->store()->has($key); } + /** + * 缓存标签 + * @access public + * @param string|array $name 标签名 + * @return TagSet + */ + public function tag($name) + { + return $this->store()->tag($name); + } + } diff --git a/src/think/cache/Driver.php b/src/think/cache/Driver.php index 9f28bfe3cf..2929e5ac83 100644 --- a/src/think/cache/Driver.php +++ b/src/think/cache/Driver.php @@ -192,7 +192,7 @@ public function remember($name, $value, $expire = null) * @param string|array $name 标签名 * @return TagSet */ - public function tag($name): TagSet + public function tag($name) { $name = (array) $name; $key = implode('-', $name); diff --git a/src/think/contract/CacheHandlerInterface.php b/src/think/contract/CacheHandlerInterface.php index c56b9d5a3b..ba2b7f1cce 100644 --- a/src/think/contract/CacheHandlerInterface.php +++ b/src/think/contract/CacheHandlerInterface.php @@ -60,7 +60,7 @@ public function remember($name, $value, $expire = null); * @param string|array $name 标签名 * @return TagSet */ - public function tag($name): TagSet; + public function tag($name); /** * 删除缓存标签