Skip to content

Commit

Permalink
改进php think optimze:schema指令无需开启fields_cache 配置
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Mar 19, 2023
1 parent ac0f18b commit eaf3c1d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/db/PDOConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,13 @@ public function getSchemaInfo(string $tableName, $force = false)
if (!isset($this->info[$schema]) || $force) {
// 读取字段缓存
$cacheKey = $this->getSchemaCacheKey($schema);
$cacheField = $this->config['fields_cache'] && !empty($this->cache);

if ($cacheField && !$force) {
if ($this->config['fields_cache'] && !empty($this->cache) && !$force) {
$info = $this->cache->get($cacheKey);
}

if (empty($info)) {
$info = $this->getTableFieldsInfo($tableName);
if ($cacheField) {
if (!empty($this->cache) && ($this->config['fields_cache'] || $force)) {
$this->cache->set($cacheKey, $info);
}
}
Expand Down

0 comments on commit eaf3c1d

Please sign in to comment.