protected function resolveDriver($name)
    {
        if ( ! isset($this->drivers[$name]) || ! $this->container->has($this->drivers[$name])) {
            throw new \RuntimeException(sprintf(
                'Caching driver "%s" does not exist or is not registered as a service.',
                $name
            ));
        }

        $driver = $this->container->get($this->drivers[$name]);

        if ( ! $driver instanceof DriverInterface) {
            throw new \RuntimeException(sprintf(
                'Service "%s" is not a valid caching driver.',
                $this->drivers[$name]
            ));
        }

        return $driver;
    }