Create Runtime driver.

@param  string  $name

@return \Orchestra\Contracts\Memory\Provider
760018
protected function createRuntimeDriver(string $name): ProviderContract
    {
        $config = $this->config['runtime'][$name] ?? [];

        return $this->createProvider(new Runtime($name, $config));
    }
1229549
public function createCache($name): Cache
    {
        if (!$this->cacheExists($name)) {
            $this->ensureCacheDir();
            /** @var Cache $cache */
            $cache = $this->app->make(Cache::class);
            $cache->setName($name);
            $cache->createCacheDir();
            $this->caches[$name] = $cache;
        }

        return $this->caches[$name];
    }
388121
protected function createApcDriver(string $name, Prop $config)
	{
		if( ! function_exists("apcu_store") )
		{
			throw new \RuntimeException("APCu client library is not loaded");
		}

		$cli = function_exists("php_sapi_name") && strpos( php_sapi_name(), "cli") !== false;
		$enable = in_array(strtolower( ini_get("apc.enable" . ($cli ? "_cli" : "d")) ), ["on", "1"]);
		if( !$enable )
		{
			throw new \RuntimeException("APCu is not enabled, change php/apc ini configuration file");
		}

		return new ApcStore(
			$name,
			$config->getOr("prefix", ""),
			$config->getOr("life", 0)
		);
	}
3731
protected function createComponentDriver($name)
    {
        $config = Arr::get($this->config, "component.{$name}", []);
        $cache  = $this->getCacheRepository($config);
        return $this->createProvider(new Component($name, $config, $this->app, $cache));
    }
730298
protected function adapterFactory(string $name): AdapterInterface
	{
		$factory = $this->adapterFactories[$name];

		return $this->adapters[$name] = $factory();
	}
1336992
public static function getInstance(string $name): \Swoole\Table
    {
        if(!static::$isInited)
        {
            throw new \RuntimeException('getInstance failed, MemoryTableManager is not initialized');
        }
        if(!isset(static::$tables[$name]))
        {
            throw new \RuntimeException(sprintf('GetInstance failed, %s is not found', $name));
        }
        return static::$tables[$name];
    }
149101
private function createCache(string $name)
	{
		$builder = $this->getContainerBuilder();

		$cache = $builder->addDefinition($this->prefix('cache.' . $name))
			->setClass(Cache::class)
			->setArguments(['@Nette\Caching\IStorage', $this->debugMode])
			->addSetup('$service->setNamespace(?)', [$this->prefix('cache.' . $name)]);

		return $cache;
	}
1080069
public function getGenerator($name)
    {
        if ($this->hasGenerator($name) === false) {
            throw new \RuntimeException(sprintf('Generator not found: "%s".', $name));
        }

        return $this->generators[$name];
    }
276815
protected function createRedisDriver(string $name, Prop $config)
	{
		if( !class_exists("Predis\\Client") )
		{
			throw new \RuntimeException("Redis client library is not loaded");
		}

		$parameters = $config->toArray();
		$options = $config->isArray("options") ? $config->get("options") : [];

		unset($parameters["options"]);

		if( ! isset($options["timeout"]) )
		{
			$options["timeout"] = 10;
		}

		if( isset($options["prefix"]) && strlen($options["prefix"]) )
		{
			$options["prefix"] = $options["prefix"] . ":";
		}

		$options["exceptions"] = true;

		return new RedisStore(
			new Client($config->toArray(), $options),
			$name,
			$config->getOr("life", 0)
		);
	}
1161068
protected function makeCurrentDriver($name)
    {
        $this->currentDriver = \App::make($this->getDriver($name), [
            'config' => config('payment.' . $name),
        ]);

        return $this;
    }
406539
private function loadMenu($name)
    {
        if ($name instanceof Menu) {
            return $name;
        }

        $menu = $this->menuRepository->findOneBy(array('name' => $name));

        if (!$menu) {
            throw new \RuntimeException(sprintf('Unable to load menu "%s"', $name));
        }

        return $menu;
    }
1345611
protected function getClass($name)
    {
        if (empty($this->adapters[$name])) {
            throw new \RuntimeException(sprintf(
                'Adapter "%s" has not been registered',
                $name
            ));
        }

        return $this->adapters[$name];
    }
286013
protected function createRegistryDriver($name)
    {
        $config = Arr::get($this->config, "registry.{$name}", []);
        $cache  = $this->getCacheRepository($config);

        return $this->createProvider(Registry::getInstance($name, $config, $this->app, $cache));
    }
483611
public function provider($name)
    {
        $slice = $this->slice->getSlice($name);

        $type  = $slice->getRequired('type');
        $class = $this->mapClasses[$type];

        return new $class($this, $slice);
    }
1005869
public function factory($label, $name, $options)
    {
        if ($this->isAlreadyRegistered($name, $label) && $this->isAlreadyLoaded($label)) {
            return $this->drivers[$label];
        }

        try {
            $cache = $this->factory->create($name, $options);
        } catch (RuntimeException $e) {
            $this->logger->error($e->getMessage());
            $cache = $this->factory->create('array', []);
        }

        if (isset($options['namespace']) && is_string($options['namespace'])) {
            $cache->setNamespace($options['namespace']);
        } else {
            $cache->setNamespace(md5(gethostname() . '-' . __DIR__));
        }

        $this->drivers[$label] = $cache;

        if (!$this->isAlreadyRegistered($name, $label)) {
            $this->register($name, $label);
            $cache->flushAll();
        }

        return $cache;
    }
128435
protected function createFluentDriver($name)
    {
        $config = Arr::get($this->config, "fluent.{$name}", []);
        $cache  = $this->getCacheRepository($config);

        return $this->createProvider(new Fluent($name, $config, $this->app->make('db'), $cache));
    }
421938
protected function getManager($name)
    {
        $id = $this->getManagerId($name);

        if ($this->getContainer()->has($id)) {
            return $this->getContainer()->get($id);
        }

        throw new \RuntimeException(
            sprintf(
                'Manager named `%s` not found. Available: `%s`.',
                $name,
                implode('`, `', array_keys($this->getContainer()->getParameter('es.managers')))
            )
        );
    }