删除指定key的缓存,若$key===true则表示删除全部
null Driver_Cache_Driver_File::delete( string $key )
参数列表
参数 类型 描述 默认值 $key
string
$key
public function delete($key)
{
if ($this->is_file_write_disalbed)return false;
if (true===$key)
{
# 删除全部
return File::remove_dir($this->dir . $this->prefix, $this->storage);
}
if (is_array($key))
{
# 支持多取
$data = array();
$i=0;
foreach ($key as $k=>$v)
{
if ($this->delete((string)$v))
{
$i++;
}
}
return $i==count($key)?true:false;
}
$filename = $this->get_filename_by_key($key);
return File::unlink($filename, $this->storage);
}