修复 文件缓存读取

This commit is contained in:
Discuz! 2017-02-13 17:07:56 +08:00
parent 506268477d
commit af9978f23d
1 changed files with 6 additions and 5 deletions

View File

@ -38,18 +38,19 @@ class memory_driver_file {
}
public function get($key) {
$data = false;
$data = null;
@include_once DISCUZ_ROOT.$this->path.$this->cachefile($key).'.php';
if($data !== false) {
if($data !== null) {
if($data['exp'] && $data['exp'] < TIMESTAMP) {
return false;
return array();
}
return $data['data'];
}
return array();
}
public function set($key, $value, $ttl = 0) {
$file = DISCUZ_ROOT.$this->path.$this->cachefile($key).'.php';
public function set($key, $value, $ttl = 0) {
$file = DISCUZ_ROOT.$this->path.$this->cachefile($key).'.php';
dmkdir(dirname($file));
$data = array(
'exp' => $ttl ? TIMESTAMP + $ttl : 0,