public function getTableSchema($name, $refresh = false)
{
if (array_key_exists($name, $this->_tables) && !$refresh) {
return $this->_tables[$name];
}
$db = $this->db;
$realName = $this->getRawTableName($name);
if ($db->enableSchemaCache && !in_array($name, $db->schemaCacheExclude, true)) {
/* @var $cache Cache */
$cache = is_string($db->schemaCache) ? Yii::$app->get($db->schemaCache, false) : $db->schemaCache;
if ($cache instanceof Cache) {
$key = $this->getCacheKey($name);
if ($refresh || ($table = $cache->get($key)) === false) {
$this->_tables[$name] = $table = $this->loadTableSchema($realName);
if ($table !== null) {
$cache->set($key, $table, $db->schemaCacheDuration, new TagDependency(['tags' => $this->getCacheTag()]));
}
} else {
$this->_tables[$name] = $table;
}
return $this->_tables[$name];
}
}
return $this->_tables[$name] = $this->loadTableSchema($realName);
}