Gets/Sets the Caching configurations

Getting:

$allConfig = Cache::config();
$configValue = Cache::config('configName');

Setting:

$config = array();
Cache::config($config);

@param mixed $config (optional)
@return mixed
963119
public static function config($config = null)
	{
		if(is_array($config)) {

            # Setting Configurations
			static::$config = $config + static::$config;
			$pathWithoutTrailingSlash = rtrim(static::$config['directory'], '/');
			static::$config['directory'] = $pathWithoutTrailingSlash.'/';

		} elseif(is_string($config)) {

            # Getting Single Config item
			return isset(static::$config[$config]) ? static::$config[$config] : null;

		} elseif(!$config) {

            # Getting All configurations
			return static::$config;
		} else {
			throw new CacheException('Invalid parameter provided for Cache::config()');
		}
	}
1282443
public static function get($config = []) {
        $key = md5(get_called_class() . serialize($config));
        if (!isset(self::$_instances[$key]))
            self::$_instances[$key] = new static($config);
        return self::$_instances[$key];
    }
162763
private static function prepareStorage($config)
    {
        $list = isset($config['storage']) ? $config['storage'] : [];
        $list = is_array($list) ? $list : [$list];
        $query = PropertyStorage::find()->select('id')->where('class_name=:className');
        if (count($list) == 0) {
            return [$query->params([':className' => StaticValues::class])->scalar() => StaticValues::class];
        }
        $storage = [];
        foreach ($list as $storageClass) {
            $storageId = PropertyStorage::getDb()->cache(
                function ($db) use ($storageClass, $query) {
                    return $query
                        ->params([':className' => $storageClass])
                        ->scalar($db);
                },
                86400,
                new TagDependency(['tags' => [PropertyStorage::commonTag()]])
            );
            if (false === $storageId) {
                continue;
            }
            $storage[$storageId] = $storageClass;
        }
        return $storage;
    }
546247
public static function config($config = []) {
		if (!$config) {
			return ['classes' => static::$_classes, 'unicode' => static::$_unicode];
		}
		if (isset($config['classes'])) {
			static::$_classes = $config['classes'] + static::$_classes;
		}
		if (isset($config['unicode'])) {
			static::$_unicode = $config['unicode'];
		}
	}
291953
public function config($config = null)
    {
        if (is_array($config)) {
            $this->_config = $config;
        } elseif (is_string($config)) {
            if (!empty($this->_config[$config])) {
                return $this->_config[$config];
            }

            return false;
        }

        return $this->_config;
    }
1090951
protected function parseConfig($config)
    {
        $parsed = [];

        foreach ($config as $key=>$value) {
            if ($value instanceof XType) {
                $parsed[$key] = $value;
                continue;
            }
            $parsed[$key] = $this->stringToType($value);
        }

        return $parsed;
    }
1328135
public static function config($config = null) {
		$defaults = ['scope' => null];

		if (is_array($config)) {
			foreach ($config as $i => $item) {
				$config[$i] += $defaults;
			}
		}
		return parent::config($config);
	}
845668
public function configure($config = [])
    {
        return new static ([
            'driver'      => 'pdo_mysql',
            'host'        => array_get($config, 'host'),
            'dbname'      => array_get($config, 'database'),
            'user'        => array_get($config, 'username'),
            'password'    => array_get($config, 'password'),
            'charset'     => array_get($config, 'charset'),
            'port'        => array_get($config, 'port'),
            'unix_socket' => array_get($config, 'unix_socket'),
            'prefix'      => array_get($config, 'prefix'),
        ]);
    }
872546
public static function config($config = []) {
		if (!$config) {
			return ['rules' => static::$_rules];
		}
		foreach ($config as $key => $val) {
			if (isset(static::${'_' . $key})) {
				static::${'_' . $key} = $val + static::${'_' . $key};
			}
		}
	}
915688
private function extractGuzzleConfig($config)
    {
        foreach (ConfigUtils::$GUZZLE_CONFIG_KEYS as $guzzleOption) {
            if (array_key_exists($guzzleOption, $config)) {
                $this->guzzleConfig[$guzzleOption] = $config[$guzzleOption];
                unset($config[$guzzleOption]);
            }
        }

        return $config;
    }
229096
public function setConfig(array $config = [])
    {
        // 设置App Key
        $this->appKey = isset($config['appKey']) ? $config['appKey'] : '';

        // 设置App Secret
        $this->appSecret = isset($config['appSecret']) ? $config['appSecret'] : '';

        // 沙箱环境
        $this->sandbox = isset($config['sandbox']) ? (bool)$config['sandbox'] : false;

        // 使用HTTPS
        $this->secure = isset($config['secure']) ? (bool)$config['secure'] : false;

        return $this;
    }
751413
public function getConfiguration(array $config, ContainerBuilder $container)
    {
        $configuration = new Configuration($this->getMainConfigParser(), $this->suggestionCollector);
        $configuration->setSiteAccessConfigurationFilters($this->siteaccessConfigurationFilters);

        return $configuration;
    }
1224131
protected function doSetup($config = array())
    {
        // Catch the configuration file path
        if (isset($config[self::CONFIG_KEY_FILE_PATH])) {
            $this->configFilePath = $config[self::CONFIG_KEY_FILE_PATH];
        } else {
            // Also consider throwing an exception here instead
            // of failing silently
            return $config;
        }

        // Catch the context
        if (isset($config[ConfigInterface::KEY_CONTEXT])) {
            $this->context = $config[ConfigInterface::KEY_CONTEXT];
        }

        return $this->readConfigurationFiles();
    }
705975
public function setDbConfig($config) {
        $this->dbConfig = $config;

        $this->db = ConnectionManager::getDataSource($config);
        $this->db->cacheSources = false;

        return $this;
    }
318368
protected function getOptionsFromConfig(Config $config)
    {
        $options = $this->options;

        if ($visibility = $config->get('visibility')) {
            // For local reference
            $options['visibility'] = $visibility;
            // For external reference
            $options['ACL'] = $visibility === AdapterInterface::VISIBILITY_PUBLIC ? 'public-read' : 'private';
        }

        if ($mimetype = $config->get('mimetype')) {
            // For local reference
            $options['mimetype'] = $mimetype;
            // For external reference
            $options['ContentType'] = $mimetype;
        }

        foreach (static::$metaOptions as $option) {
            if ( ! $config->has($option)) {
                continue;
            }
            $options[$option] = $config->get($option);
        }

        return $options;
    }
952735
public function getConfiguration(array $config, ContainerBuilder $container)
    {
        $configuration = $this->getConfigurationInstance();
        if ($configuration) {
            $container->addObjectResource($configuration);
        }

        return $configuration;
    }
142799
protected function getConfig(array $config): array
    {
        $keys = ['app_id', 'app_secret'];

        foreach ($keys as $key) {
            if (!array_key_exists($key, $config)) {
                throw new InvalidArgumentException("Missing configuration key [$key].");
            }
        }

        return array_only($config, [
            'app_id',
            'app_secret',
            'default_access_token',
            'default_graph_version',
            'enable_beta_mode',
            'http_client_handler',
            'persistent_data_handler',
            'url_detection_handler',
        ]);
    }