/** * 获得Factory对象 * @param string $cache_adapter * @throws Exception */ function __construct($name) { $env = getenv('RUNTIME_ENVIROMENT') ? getenv('RUNTIME_ENVIROMENT') : (defined('SHELL_VARIABLE') ? SHELL_VARIABLE : ''); $env = empty($env) ? 'local' : $env; $cache_config = Config::getCacheConfig(); $config = $cache_config['cache'][$name]; if (!is_array($config)) { throw new \Exception('缓存配置错误'); } $this->cache_config = $config[$env]; $this->adapter = $name; }