Create a cache store instance.

@param  mixed $config
@return \League\Flysystem\Cached\CacheInterface

@throws \InvalidArgumentException
190699
protected function createCacheStore($config)
    {
        if ($config === true) {
            return new MemoryStore;
        }

        return new Cache(
            $this->app['cache']->store($config['store']),
            array_get($config, 'prefix', 'flysystem'),
            array_get($config, 'expire')
        );
    }
1143159
public function createConnector(array $config)
    {
        if (!isset($config['driver'])) {
            throw new InvalidArgumentException('A driver must be specified.');
        }

        if ($this->container->has($key = "db.connector.{$config['driver']}")) {
            return $this->container->get($key);
        }

        switch ($config['driver']) {
            case 'mysql':
                return new MySqlConnector;
            case 'pgsql':
                return new PostgresConnector;
            case 'sqlite':
                return new SQLiteConnector;
            case 'sqlsrv':
                return new SqlServerConnector;
        }

        throw new InvalidArgumentException("Unsupported driver [{$config['driver']}]");
    }
930396
protected function createMemcachedDriver(array $config)
    {
        $prefix = $this->getPrefix($config);

        // Extract Plus features from config
        $persistentConnectionId = array_get($config, 'persistent_id');
        $customOptions = array_get($config, 'options', []);
        $saslCredentials = array_filter(array_get($config, 'sasl', []));

        $memcached = $this->app['memcached.connector']->connect(
            $config['servers'],
            $persistentConnectionId,
            $customOptions,
            $saslCredentials
        );

        return $this->repository(new MemcachedStore($memcached, $prefix));
    }
301252
public static function getInheritanceFinder(ConfigInterface $config) {
        if($config instanceof FileConfig){
            $cacheStrategy = new \Synga\InheritanceFinder\File\CacheStrategy($config);
        } elseif($config instanceof DatabaseConfig){
            $cacheStrategy = new \Synga\InheritanceFinder\Database\CacheStrategy($config);
        }

        return new \Synga\InheritanceFinder\InheritanceFinder(
            new \Synga\InheritanceFinder\CacheBuilder(
                $cacheStrategy,
                new PhpClassParser((new ParserFactory)->create(ParserFactory::PREFER_PHP7), new ClassNodeVisitor()),
                new \Symfony\Component\Finder\Finder(),
                new \Synga\InheritanceFinder\Helpers\FastArrayAccessHelper()
            )
        );
    }
988662
public function make(array $config)
    {
        $driver = $this->getDriver($config);

        // First we will check by the server driver type to see if an extension
        // has been registered specifically for that server.
        if (isset($this->serverExtensions[$driver])) {
            $server = call_user_func($this->serverExtensions[$driver], $config);
        }

        // Create a built-in server with given driver type.
        elseif (method_exists($this, $method = 'create'.Str::studly($driver).'Driver')) {
            $server = $this->$method($config);
        }

        // Otherwise, if the driver type does not support, an exception will be thrown.
        else {
            throw new InvalidArgumentException("Driver [{$driver}] is not supported.");
        }

        $this->configureServer($server, $config);

        return $server;
    }
1018981
public static function simple(array $config = []): CacheInterface
    {
        [$hash, $config] = static::getKey($config, 'cache.simple');

        if (isset(static::$pool[$hash])) {
            return static::$pool[$hash];
        }

        if (isset($config['drivers'])) {
            $drivers = $config['drivers'];
            if (\count($drivers) > 1) {
                return static::$pool[$hash] = new Chain($config);
            }

            unset($config['drivers']);

            $driver = \key($drivers);
            $config += $drivers[$driver];
        } else {
            $driver = $config['driver'] ?? 'void';
            unset($config['driver']);
        }

        switch ($driver) {
            case 'array':
            case 'zend':
                $driver = \ucfirst($driver) . 'Data';
                break;
            case 'apc':
                $driver = 'Apcu';
                break;
            default:
                $driver = \ucfirst($driver);
        }

        $class = 'Hail\\Cache\\Simple\\' . $driver;

        return static::$pool[$hash] = new $class($config);
    }
1091971
public function createConnector(array $config)
    {
        if (!isset($config['driver'])) {
            throw new InvalidArgumentException('A driver must be specified.');
        }

        switch ($config['driver']) {
            case 'buzz':
                return new BuzzConnector();
            case 'guzzle':
                return new GuzzleConnector();
            case 'guzzlehttp':
                return new GuzzleHttpConnector();
        }

        throw new InvalidArgumentException("Unsupported driver [{$config['driver']}].");
    }
449673
public static function getInstance($config = array())
    {
        static $instance;

        if ($instance === null) {
            if (!$config instanceof AnConfig) {
                $config = new AnConfig($config);
            }

            $instance = new self($config);
        }

        return $instance;
    }
888784
public function create($adapterType, array $config)
    {
        if (!array_key_exists($adapterType, $this->adapters)) {
            throw new \InvalidArgumentException(
                sprintf('Cache Adapter\'s key %s does not exist', $adapterType)
            );
        }

        /**
         * @fixme : Active this part & clean cache config
         */
        if (!isset($config[$adapterType])) {
            throw new InvalidConfigurationException(
                sprintf('Config is not set for adapter %s', $adapterType)
            );
        }

        return new $this->adapters[$adapterType]($config[$adapterType]);
    }
943469
public function setConfig($config)
    {
        if (is_array($config)) {
            $this->config = $this->createConfig($config);
        } elseif ($config instanceof ConfigInterface) {
            $this->config = $config;
        } else {
            throw new InvalidArgumentException(
                'Configuration must be an array or a ConfigInterface object.'
            );
        }
        return $this;
    }
1291944
final public static function getInstance($config = array())
    {
        static $instance;

        if ($instance === NULL)
        {
            if(!$config instanceof KObjectConfig) {
                $config = new KObjectConfig($config);
            }

            $instance = new self($config);
        }

        return $instance;
    }
233617
public function setConfigs($config)
    {
        if (is_array($config) === false && $config instanceof \Traversable === false) {
            throw new \InvalidArgumentException(
                'Expected an array or Traversable; received: ' .
                (is_object($config) === true ? get_class($config) : gettype($config))
            );
        }
        foreach ($config as $name => $value) {
            $this->setConfig($name, $value);
        }
        return $this;
    }
791166
protected function createDatabaseDriver( array $config )
	{
		return new DatabaseStore( DatabaseManager::i()->connection( Arr::get( $config, 'connection' ) ), Encrypter::i(), $config['table'], $this->getPrefix( $config ) );
	}
992142
protected function createDatabaseDriver(array $config)
    {
        return new DatabaseRepository(
            $this->app['db']->connection(Arr::get($config, 'connection')),
            Arr::get($config, 'table')
        );
    }
47208
public static function getInstance($Config)
    {
        if (!self::$Instance) {
            self::$Instance = CacheFactory::factory($Config);
        }
        return self::$Instance;
    }
1234141
private function _createContainer(Config $config = null)
	{
		$container = new Container();

		if ( isset($config) ) {
			$container['config'] = $config;
		}

		return $container;
	}
145641
private static function createConfiguration(array $config, ContainerInterface $container = null)
    {
        $cache = $config['cache'];

        if ($container && is_string($config['cache']) && $container->has($config['cache'])) {
            $cache = $container->get($config['cache']);
        }

        return Setup::createConfiguration($config['debug'], $config['proxy_dir'], $cache);
    }