缓存类增加tag方法 用于缓存标签设置 clear方法支持清除某个缓存标签的数据

This commit is contained in:
thinkphp
2016-08-17 16:12:49 +08:00
parent 65053bc1a5
commit 631334b31e
10 changed files with 283 additions and 26 deletions

View File

@@ -155,13 +155,26 @@ class Cache
/**
* 清除缓存
* @access public
* @param string $tag 标签名
* @return boolean
*/
public static function clear()
public static function clear($tag = null)
{
self::init();
self::$writeTimes++;
return self::$handler->clear();
return self::$handler->clear($tag);
}
/**
* 缓存标签
* @access public
* @param string $name 标签名
* @return \think\cache\Driver
*/
public static function tag($name)
{
self::init();
return self::$handler->tag($name);
}
}