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);
    }
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);
    }
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 ) ; }
Obtains the metadata for the named index.
@param string $name index name. The index name may contain schema name if any. Do not quote the index name.
@param bool $refresh whether to reload the index schema even if it is found in the cache.
@return IndexSchema|null index metadata. `null` - if the named index does not exist.
Obtains the metadata for the named index .