yii\sphinx\Schema::getIndexSchema PHP Метод

getIndexSchema() публичный Метод

Obtains the metadata for the named index.
public getIndexSchema ( string $name, boolean $refresh = false ) : IndexSchema | null
$name string index name. The index name may contain schema name if any. Do not quote the index name.
$refresh boolean whether to reload the index schema even if it is found in the cache.
Результат IndexSchema | null index metadata. `null` - if the named index does not exist.
    public function getIndexSchema($name, $refresh = false)
    {
        if (isset($this->_indexes[$name]) && !$refresh) {
            return $this->_indexes[$name];
        }
        $db = $this->db;
        $realName = $this->getRawIndexName($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 || ($index = $cache->get($key)) === false) {
                    $index = $this->loadIndexSchema($realName);
                    if ($index !== null) {
                        $cache->set($key, $index, $db->schemaCacheDuration, new TagDependency(['tags' => $this->getCacheTag()]));
                    }
                }
                return $this->_indexes[$name] = $index;
            }
        }
        return $this->_indexes[$name] = $this->loadIndexSchema($realName);
    }