修复 修正File缓存细节

This commit is contained in:
Discuz! 2017-02-14 10:25:10 +08:00
parent ce02aa5cb6
commit 249688255a
1 changed files with 2 additions and 11 deletions

View File

@ -15,7 +15,6 @@ class memory_driver_file {
public $cacheName = 'File';
public $enable;
public $path;
public $cacheData;
public function env() {
return true;
@ -38,13 +37,13 @@ class memory_driver_file {
return str_replace('_', '/', $key).'/'.$key;
}
private function _get($key) {
public function get($key) {
$file = DISCUZ_ROOT.$this->path.$this->cachefile($key).'.php';
if(!file_exists($file)) {
return false;
}
$data = null;
@include_once $file;
@include $file;
if($data !== null) {
if($data['exp'] && $data['exp'] < TIMESTAMP) {
return false;
@ -55,13 +54,6 @@ class memory_driver_file {
return false;
}
}
public function get($key) {
if(!isset($this->cacheData[$key])) {
$this->cacheData[$key] = $this->_get($key);
}
return $this->cacheData[$key];
}
public function set($key, $value, $ttl = 0) {
$file = DISCUZ_ROOT.$this->path.$this->cachefile($key).'.php';
@ -71,7 +63,6 @@ class memory_driver_file {
'data' => $value,
);
file_put_contents($file, "<?php\n\$data = ".var_export($data, 1).";\n");
$this->cacheData[$key] = $value;
return true;
}