public function insert(array $values) { if ($this->needFlushCache()) { // 清空表级缓存 $meta = $this->getMeta(); $meta->flush($this->db(), $this->model->table()); if (!is_array(reset($values))) { $values = [$values]; } $toClearIds = []; foreach ($values as $value) { $toClearIds[] = $value[$this->model->primaryKey()]; } $toClearKeys = $this->buildRowCacheKey($toClearIds); $this->getCache()->del(array_values($toClearKeys)); } return parent::insert($values); }