public function cache($flush = false) { $name = $this->table(); $cache = zotop::cache($name); if (empty($cache) || $flush) { $cache = $this->getAll(); if (is_array($cache)) { zotop::cache($name, $cache, 3000); } } return $cache; }
public function cache($modelid, $flush = false) { $name = $this->table() . '-' . $modelid; //获取缓存 $cache = zotop::cache($name); if (empty($cache) or $flush) { //更新表字段数据 $modelcontent = zotop::model('content.modelcontent'); $modelcontent->modelid = $modelid; $modelcontent->field(true); //更新缓存数据 $cache = $this->getAll($modelid); if (is_array($cache)) { zotop::cache($name, $cache); } } return $cache; }
public function cache($flush = false) { $name = $this->table(); $data = zotop::cache($name); if ($flush || empty($data)) { $data = $this->getAll(); if (is_array($data)) { zotop::cache($name, $data); } } return $data; }