/** * @param array $cacheSettings * * @return CacheProvider */ public function create(array $cacheSettings) { $config = new Config($cacheSettings); $cacheClassName = sprintf($config->getAdapterNamespace(), $config->getAdapterName()); if (!class_exists($cacheClassName)) { throw new InvalidCacheConfigException('Cache Adapter Not Supported!'); } $cacheProvider = new $cacheClassName(); if ($config->isConnectable() === true) { $this->addConnection($cacheProvider, $config); } return $cacheProvider; }
/** * @param Config $config * * @return CacheProvider * * @throws InvalidCacheConfigException */ public function create(Config $config) { $this->config = $config; $cacheClassName = sprintf($config->getAdapterNamespace(), $this->config->getAdapterName()); if (!class_exists($cacheClassName)) { throw new InvalidCacheConfig('Cache Adapter Not Supported!'); } /** @var CacheProvider $cacheProvider */ $cacheProvider = new $cacheClassName(); if (!$this->isValidConfig($this->config)) { throw new InvalidCacheConfig('Options Not Supported Passed'); } return $this->decorateWithConnectable($cacheProvider); }