Skip to content

Commit

Permalink
Merge branch '8.0' of github.com:top-think/framework into 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Oct 17, 2023
2 parents b8e1baf + a272dd0 commit 5e59fb1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/think/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}

}
2 changes: 1 addition & 1 deletion src/think/cache/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/think/contract/CacheHandlerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
* 删除缓存标签
Expand Down

0 comments on commit 5e59fb1

Please # to comment.