删除缓存
@param string $alias 别名
@param array $config 配置
@return bool
761056
public function remove($alias, $config = array())
	{
		$timeout = isset($config['timeout']) ? $config['timeout'] : 0;
		return $this->cache->delete($alias,$timeout);
	}
1255428
private function process_aliases( $aliases, $alias, $config_path, $operation = '' ) {
		// Convert data to YAML string.
		$yaml_data = Spyc::YAMLDump( $aliases );

		// Add data in config file.
		if ( file_put_contents( $config_path, $yaml_data ) ) {
			WP_CLI::success( "$operation '{$alias}' alias." );
		}
	}
105898
final public function hasIndex(string $alias): bool
    {
        $this->loadIndexes();
        return isset($this->gsi[$alias]);
    }
810465
public function get($alias, $default = false, $config = array())
	{
		$result = $this->cache->get($alias,isset($config['cache_cb']) ? $config['cache_cb'] : null,isset($config['cas_token']) ? $config['cas_token'] : null);
		if(false === $result)
		{
			return $this->parseDefault($default);
		}
		else
		{
			return $result;
		}
	}
1328743
public static function alias(&$config, $key, $alias){
		if(!isset($config[$alias]))
			return;
		$tmp = & $config;
		foreach(explode('.', $key) as $key){
			$tmp = & $tmp[$key];
		}
		if(!isset($tmp))
			$tmp = $config[$alias];
	}
1186484
public static function instance($config = [], $name = false)
    {
        if (false === $name) {
            $name = md5(serialize($config));
        }

        if (true === $name || !isset(self::$instance[$name])) {
            // 解析连接参数 支持数组和字符串
            $options = self::parseConfig($config);

            if (true === $name) {
                $name = md5(serialize($config));
            }
            self::$instance[$name] = new static($options);
        }

        return self::$instance[$name];
    }
464831
public function client(array $config)
    {
        $key = $this->getClientKey($config);

        if (isset($this->clients[$key])) {
            return $this->clients[$key];
        }

        return $this->clients[$key] = $this->createClient($config);
    }
176436
public function init($config = [])
    {

        if (isset($config['session_cache'])) {
            $session_type = $config['session_cache'];
        } else {
            $session_type = $config['cache_type'];
        }

        /**
         * initialize the current Cache
         */
        $param              = new \stdClass();
        $param->type        = (string)$session_type;
        $param->credentials = (($s = Config::get('session_cache_settings') == '') ? Config::get('cache_settings') : $s);
        // write it to the cache
        $this->engine = CacheManager::getInstance($param);

        if (!$this->engine || !$this->engine->isConnected()) return false;

        return true;
    }
957166
private function getConfigForPath(array $config, string $path, string $alias)
    {
        $steps = explode('.', $path);

        foreach ($steps as $step) {
            if (!\array_key_exists($step, $config)) {
                throw new LogicException(sprintf('Unable to find configuration for "%s.%s"', $alias, $path));
            }

            $config = $config[$step];
        }

        return $config;
    }
1081136
public function exists($alias, $config = array())
	{
		$tableName = $this->cache->parseField($this->tableName);
		$key = $this->cache->parseField('key');
		return 0 < $this->cache->queryValue(<<<SQL
select 1 from {$tableName} where {$key} = %s
SQL
,array($alias));
	}
476232
private function _hasMany(array $config): ResultSet
    {
        //配置信息
        $tableClass = $config['table'];
        $primaryKey = $config['primaryKey'];
        $foreignKey = $config['foreignKey'];

        //取主键的值
        $primaryValue = $this->$primaryKey;

        /**
         * 子对象表
         * @var $tableInstance Table
         */
        $tableInstance = $tableClass::instance();

        //在子对象表中查询关联记录
        return ResultSet::instance($tableInstance->select('*', [$foreignKey => $primaryValue]))
            ->_setType('hasMany', $config);
    }
172544
public static function model($alias, $params = [], $config = [])
    {
        //$module = static::getInstance(); // built-in - get only from loaded modules
        $module = static::instance();
        if (!empty($module)) {
            return $module->getDataModel($alias, $params, $config);
        }
    }
154293
public function set($alias, $value, $config = array())
	{
		$expire = isset($config['expire']) ? $config['expire'] : 0;
		if($expire > 0)
		{
			return $this->cache->setex($alias,$expire,$value);
		}
		else
		{
			return $this->cache->set($alias,$value);
		}
	}
552727
public function removeAlias($alias)
    {
        if (isset($this->aliases[$alias])) {
            unset($this->aliases[$alias]);
            return true;
        }

        return false;
    }
1028437
public static function makeProxy(string $name, array $config)
    {
        $mode = $config['mode'];
        if ($mode == Macro::MASTER_SLAVE) {
            return new MysqlProxyMasterSlave($name, $config);
        } else {
            return false;
        }
    }
228544
protected function _create($class, $alias, $config)
    {
        $instance = new $class($this->_collection, $config);
        $enable = isset($config['enabled']) ? $config['enabled'] : true;
        if ($enable) {
            $this->eventManager()->on($instance);
        }
        $methods = $this->_getMethods($instance, $class, $alias);
        $this->_methodMap += $methods['methods'];
        $this->_finderMap += $methods['finders'];

        return $instance;
    }
318070
public function loadCachedConfig(array &$config)
    {
        $cacheFilePath = $this->config->getCacheFile();

        if (!file_exists($cacheFilePath)) {
            return false;
        }

        $cachedConfig = include $cacheFilePath;

        if (!is_array($cachedConfig)) {
            return false;
        }

        if (!isset($config['routes'])) {
            $config['routes'] = array();
        }

        $this->merger->merge($cachedConfig, $config['routes']);

        return true;
    }