public function set($name, $value, $expire = null)
{
N('cache_write', 1);
if (is_null($expire)) {
$expire = $this->options['expire'];
}
$data = serialize($value);
if (C('DATA_CACHE_COMPRESS') && function_exists('gzcompress')) {
//数据压缩
// $data = gzcompress($data,3);
$data = gzencode($data) . "";
}
if (C('DATA_CACHE_CHECK')) {
//开启数据校验
$check = md5($data);
} else {
$check = '';
}
$data = $check . $data;
$result = $this->_handler->set($name, $data, 0, intval($expire));
if ($result) {
if ($this->options['length'] > 0) {
// 记录缓存队列
$this->queue($name);
}
return true;
} else {
return false;
}
}