public function setResolver(string $type, SubResolver $resolver)
    {
        if (!isset($this->resolvers[$type]))
            throw new \InvalidArgumentException("Unknown resolver type: " . $type);

        if ($this->cache !== null)
            $resolver->setCache($this->cache);

        $this->resolvers[$type]['resolver'] = $resolver;
        return $this;
    }