Warms up the cache.

@param string $cacheDir The cache directory
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
            }
        }
    }
789608
private function prepareBuilder(): void
    {
        if (!file_exists($this->getReportCacheDir())) {
            @mkdir($this->getReportCacheDir(), 0777, true);
        }

        $this->builder
             ->setCacheDir($this->getReportCacheDir())
             ->initialise();

        return;
    }
772089
public function warmUp($cacheDir)
    {
        if (!$this->viewReferenceRepository->hasReference()) {
            $this->viewReferenceManager->saveReferences(
                $this->viewHelper->buildViewsReferences()
            );
        }
    }
692850
private function set_cache_dir() {
		$path = sys_get_temp_dir() . '/wp-cli-test-cache';
		if ( ! file_exists( $path ) ) {
			mkdir( $path );
		}
		$this->variables['CACHE_DIR'] = $path;
	}
515143
public function setCacheFolder(?string $cacheFolder)
	{
		if (substr($cacheFolder, -1) !== '/') {
			$cacheFolder .= "/";
		}
		$this->cacheFolder = $cacheFolder;
		$this->initCache();
		return $this;
	}
581203
public function enableCaching()
    {
        if (FileSystemHelper::folderExists($this->getCacheDir())) {
            $this->caching = true;
            return true;
        }
        return false;
    }
889157
public function setCacheDir($dir)
    {
        $this->cacheDir = $dir;

        if (!is_dir($this->cacheDir)) {
            $this->createDir($this->cacheDir);
        }
    }
624392
public function warmUp($cacheDir)
    {
        $dir = $cacheDir.'/victoire/Entity';
        $file = $dir.'/EntityProxy.php';

        if (!file_exists($dir)) {
            if (false === @mkdir($dir, 0777, true)) {
                throw new \RuntimeException(sprintf('Could not create directory "%s".', $dir));
            }
        }

        $generator = new EntityProxyGenerator($this->businessEntityHelper, $this->fileLocator);
        $cacheContent = $generator->generate();

        $this->writeCacheFile($file, $cacheContent);
        if (!class_exists('Victoire\\Bundle\\CoreBundle\\Entity\\EntityProxy')) {
            include_once $file;
        }
    }
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);
        }
    }
949989
public function searchOrigDir(File $cacheDir) {
        foreach ($this->autoDirPathMap as $entry_set) {
            $orig_dir = $entry_set[0];
            $cache_dir = $entry_set[1];
            if ($cacheDir->getAbsolutePath() === $cache_dir->getAbsolutePath()) {
                return $orig_dir;
            }
        }
        return null;
    }
205611
public function setCacheDir($cacheDir)
    {
        if (!$cacheDir) {
            throw new \InvalidArgumentException('The parameter $cacheDir must not be empty.');
        }

        if (!is_dir($cacheDir) && !mkdir($cacheDir, 0777, true)) {
            throw new \RuntimeException('Unable to create the directory "'.$cacheDir.'"');
        }

        // remove trailing slash
        if (in_array(substr($cacheDir, -1), array('\\', '/'))) {
            $cacheDir = substr($cacheDir, 0, -1);
        }

        $this->_cacheDir = $cacheDir;
    }
140464
public function warmUp($cacheDir)
    {

        $fs = new FileSystem();
        $fs->dumpFile($this->cacheDir . '/swagger/swagger.json', $this->swaggerBuilder->buildSwagger());
    }
1212986
public function warmUp($cacheDir)
    {
        $templates = array();

        /** @var \Symfony\Component\Templating\TemplateReferenceInterface $template */
        foreach ($this->finder->findAllTemplates() as $template) {
            $templates[$template->getLogicalName()] = $this->locator->locate($template);

            if (!$template instanceof TemplateReference) {
                continue;
            }

            $bundle = $template->get('bundle');
            if (empty($bundle)) {
                continue;
            }
            // Resolve the base bundle
            $bundles = $this->kernel->getBundle($bundle, false);
            $baseBundle = end($bundles);

            // Resolve the base path
            $relativePath = substr($template->getPath(), strlen($bundle) + 1);
            $baseBundlePath = $baseBundle->getPath() . $relativePath;

            // Check if the base is the same if not add the override to the template cache
            if ($templates[$template->getLogicalName()] !== $baseBundlePath) {
                $templates['!'.$template->getLogicalName()] = $baseBundlePath;
            }
        }

        $this->writeCacheFile($cacheDir.'/templates.php', sprintf('<?php return %s;', var_export($templates, true)));
    }
118745
public function setCacheDir($dir)
    {
        if (!is_dir($dir)) {
            $this->createDir($dir);
        }
        if (!is_writable($dir)) {
            throw new \InvalidArgumentException(sprintf('The cache directory "%s" is not writable.', $dir));
        }

        $this->cacheDir = $dir;

        return $this;
    }
68643
public function getCacheDir()
    {
        if ($this->cacheDir === null) {
            $this->setCacheDir(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR);
        }

        return $this->cacheDir;
    }
1254999
public function load(Cache $cache, $cacheId)
    {
        if ($cache->contains($cacheId)) {

            /**
             * Cache contains gearman structure
             */
            $this->workerCollection = $cache->fetch($cacheId);

        } else {

            /**
             * Cache is empty.
             *
             * Full structure must be generated and cached
             */
            $this->workerCollection = $this
                ->getGearmanParser()
                ->load()
                ->toArray();

            $cache->save($cacheId, $this->workerCollection);
        }

        return $this;
    }
1023343
public function warmUp($cacheDir)
    {
        $router = $this->container->get('router');

        if ($router instanceof WarmableInterface) {
            $router->warmUp($cacheDir);

            return;
        }

        @trigger_error(sprintf('Passing a %s without implementing %s is deprecated since Symfony 4.1.', RouterInterface::class, WarmableInterface::class), \E_USER_DEPRECATED);
    }