diff --git a/upload/source/class/discuz/discuz_table.php b/upload/source/class/discuz/discuz_table.php index dbf546c..e15a1bc 100644 --- a/upload/source/class/discuz/discuz_table.php +++ b/upload/source/class/discuz/discuz_table.php @@ -18,6 +18,8 @@ class discuz_table extends discuz_base public $data = array(); public $methods = array(); + + public $empty_ttl = 30; protected $_table; protected $_pk; @@ -92,7 +94,11 @@ 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); + if(!empty($data)) { + $this->store_cache($id, $data); + } else { + $this->store_cache($id, array(), $this->empty_ttl); + } } } return $data; @@ -113,6 +119,12 @@ 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; diff --git a/upload/source/class/table/table_forum_post.php b/upload/source/class/table/table_forum_post.php index be4b909..d80be62 100644 --- a/upload/source/class/table/table_forum_post.php +++ b/upload/source/class/table/table_forum_post.php @@ -19,7 +19,8 @@ class table_forum_post extends discuz_table $this->_table = 'forum_post'; $this->_pk = 'pid'; - + $this->_pre_cache_key = 'forum_post_'; + $this->_cache_ttl = 0; parent::__construct(); }