public function setTwigCache($cacheDir)
    {
        if (!is_dir($cacheDir) && (!is_writable(dirname($cacheDir)) || false === @mkdir($cacheDir, 0755))) {
            throw new RendererException(
                sprintf('Unable to create twig cache "%s"', $cacheDir),
                RendererException::RENDERING_ERROR
            );
        }

        if (!is_writable($cacheDir)) {
            throw new RendererException(
                sprintf('Twig cache "%s" is not writable', $cacheDir),
                RendererException::RENDERING_ERROR
            );
        }

        $this->twig->setCache($cacheDir);
    }