改进缓存标签的设置和删除

This commit is contained in:
thinkphp
2016-08-17 19:07:29 +08:00
parent 684c04849a
commit 90fc917b00
9 changed files with 112 additions and 78 deletions

View File

@@ -80,6 +80,17 @@ abstract class Driver
*/
abstract public function clear($tag = null);
/**
* 获取实际的缓存标识
* @access public
* @param string $name 缓存名
* @return string
*/
protected function getCacheKey($name)
{
return $this->options['prefix'] . $name;
}
/**
* 缓存标签
* @access public
@@ -96,6 +107,7 @@ abstract class Driver
if (is_string($keys)) {
$keys = explode(',', $keys);
}
$keys = array_map([$this, 'getCacheKey'], $keys);
$value = array_unique(array_merge($this->getTagItem($name), $keys));
$this->set($key, implode(',', $value));
}