临时恢复 待优化

This commit is contained in:
Comsenz 2017-08-16 11:22:06 +08:00
parent e99b4efb64
commit d76a096e96
1 changed files with 3 additions and 20 deletions

View File

@ -19,7 +19,6 @@ class discuz_table extends discuz_base
public $methods = array();
protected $_empty_ttl;
protected $_table;
protected $_pk;
protected $_pre_cache_key;
@ -31,12 +30,6 @@ class discuz_table extends discuz_base
$this->_table = $para['table'];
$this->_pk = $para['pk'];
}
if(!isset($this->_empty_ttl) && ($empty_ttl = getglobal('config/cache/empty_ttl'))) {
$this->_empty_ttl = $empty_ttl;
}
if(empty($this->_empty_ttl)) {
$this->_empty_ttl = 30;
}
if(isset($this->_pre_cache_key) && (($ttl = getglobal('setting/memory/'.$this->_table)) !== null || ($ttl = $this->_cache_ttl) !== null) && memory('check')) {
$this->_cache_ttl = $ttl;
$this->_allowmem = true;
@ -99,11 +92,7 @@ class discuz_table extends discuz_base
if(!empty($id)) {
if($force_from_db || ($data = $this->fetch_cache($id)) === false) {
$data = DB::fetch_first('SELECT * FROM '.DB::table($this->_table).' WHERE '.DB::field($this->_pk, $id));
if(!empty($data)) {
$this->store_cache($id, $data);
} else {
$this->store_cache($id, array(), $this->_empty_ttl);
}
if(!empty($data)) $this->store_cache($id, $data);
}
}
return $data;
@ -124,12 +113,6 @@ class discuz_table extends discuz_base
$this->store_cache($value[$this->_pk], $value);
}
}
$diff_ids = array_diff($ids, array_keys($data));
if(!empty($diff_ids)) {
foreach($diff_ids as $diff_id) {
$this->store_cache($diff_id, array(), $this->_empty_ttl);
}
}
}
}
return $data;