Set Twig cache directory.

@param string $cacheDir
13695
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);
    }
386823
public function setCacheDir($cacheDir)
    {
        if ($cacheDir !== null) {
            if (!is_dir($cacheDir)) {
                throw new Exception\InvalidArgumentException(
                    "Cache directory '{$cacheDir}' not found or not a directory"
                );
            } elseif (!is_writable($cacheDir)) {
                throw new Exception\InvalidArgumentException(
                    "Cache directory '{$cacheDir}' not writable"
                );
            } elseif (!is_readable($cacheDir)) {
                throw new Exception\InvalidArgumentException(
                    "Cache directory '{$cacheDir}' not readable"
                );
            }

            $cacheDir = rtrim(realpath($cacheDir), DIRECTORY_SEPARATOR);
        } else {
            $cacheDir = sys_get_temp_dir();
        }

        $this->cacheDir = $cacheDir;

        return $this;
    }
957495
public function clear($cacheDir)
    {
        if (is_dir($this->legacyRootDir.'/innomatic/setup')) {
            return;
        }

        $this->legacyKernel->runCallback(
            function () {
                $gc = new CacheGarbageCollector();
                $gc->emptyCache();
            }
        );
    }
635484
public function setDirectory($directory)
	{
		$this->directory = $directory;

		// Set the finder to use this directory as well
		$this->finder->in($directory);

		return $this;
	}
889157
public function setCacheDir($dir)
    {
        $this->cacheDir = $dir;

        if (!is_dir($this->cacheDir)) {
            $this->createDir($this->cacheDir);
        }
    }
753589
protected function addCacheDirectory(ContainerInterface $container, SerializerBuilder $builder): void
    {
        $config = $container->get('config');
        $libraryConfig = $config[ConfigKey::PROJECT][ConfigKey::API_CLIENT] ?? [];
        $cacheDir = (string) ($libraryConfig[ConfigKey::CACHE_DIR] ?? '');

        if ($cacheDir !== '') {
            $builder->setCacheDir($cacheDir);
        }
    }
367864
public function add_template_directory($directory, $namespace = null) {
		if ($this->filesystem_loader === null) {
			$this->filesystem_loader = new \Twig_Loader_Filesystem($directory);
		}

		if ($namespace === null) {
			$this->filesystem_loader->addPath($directory);
		} else {
			$this->filesystem_loader->addPath($directory, $namespace);
		}
	}
465157
public function set($cacheId, $value)
    {
        $this->setToFirstLevelCache($cacheId, $value);
        $this->secondLevelCache->set($cacheId, $value);
    }
988709
public function setCachePath($cachePath = NULL)
    {
        $this->cachePath = $cachePath;
        $this->debug->debug(__FUNCTION__, 'setCachePath: ', $this->cachePath);
    }
721553
public function setDirectory(Directory $directory)
    {
        $this->directory = $directory;
        $this->iterator = new \ArrayIterator($directory->children());
    }
822653
static function cleanupCacheDir( $cacheDir )
    {
        $ini = eZINI::instance();
        if ( $ini->variable( 'TemplateSettings', 'DelayedCacheBlockCleanup' ) === 'enabled' )
        {
            eZSubtreeCache::renameDir( $cacheDir );
        }
        else
        {
            eZSubtreeCache::removeExpiryCacheFromDisk( $cacheDir );
        }
    }
17130
def set_cache_dir(directory):
    
    global cache_dir

    if directory is None:
        cache_dir = None
        return

    if not os.path.exists(directory):
        os.makedirs(directory)
    if not os.path.isdir(directory):
        raise ValueError("not a directory")
    cache_dir = directory
1083016
public function warmUp($cacheDir)
    {
        /** @var RouterRegistry $registry */
        $registry = $this->container->get('gos_pubsub_router.router.registry');

        foreach ($registry->getRouters() as $router) {
            if ($router instanceof WarmableInterface) {
                $router->warmUp($cacheDir);
            }
        }
    }
475257
public function warmUp($cacheDir)
    {
        $baseDir = $this->annotationDir.DIRECTORY_SEPARATOR.'Sidus'.DIRECTORY_SEPARATOR.'EAV'.DIRECTORY_SEPARATOR;
        if (!@mkdir($baseDir, 0777, true) && !is_dir($baseDir)) {
            throw new \RuntimeException("Unable to create annotations directory: {$baseDir}");
        }

        foreach ($this->familyRegistry->getFamilies() as $family) {
            $content = $this->getFileHeader($family);

            foreach ($family->getAttributes() as $attribute) {
                $content .= $this->getAttributeMethods($family, $attribute);
            }

            $content .= "}\n";

            $this->writeFile($baseDir.$family->getCode().'.php', $content);
        }
    }
327300
public function warmUp($cacheDir)
    {
        if (null === $this->finder) {
            return;
        }

        $twig = $this->container->get('twig');

        $templates = $this->finder->findAllTemplates();

        foreach ($this->paths as $path => $namespace) {
            $templates = array_merge($templates, $this->findTemplatesInFolder($namespace, $path));
        }

        foreach ($templates as $template) {
            try {
                $twig->loadTemplate($template);
            } catch (Error $e) {
                // problem during compilation, give up
            }
        }
    }
359415
public function enableFileCaching($cacheDirectory)
    {
        $this->cacheStack[] = ['name' => 'files', 'class' => new FileCache($cacheDirectory)];
        $this->cacheDepth = count($this->cacheStack);
    }
63934
public function warmUp($cacheDir): void
    {
        if ($this->configLoader instanceof WarmableInterface) {
            $this->configLoader->warmUp($cacheDir);
        }
    }