Warm the view cache file (if needed or force mode).

@param string $cacheDir Where does the viewsReferences file should take place
772089
public function warmUp($cacheDir)
    {
        if (!$this->viewReferenceRepository->hasReference()) {
            $this->viewReferenceManager->saveReferences(
                $this->viewHelper->buildViewsReferences()
            );
        }
    }
695423
public function setDir($dir)
    {
        if (empty($dir) || !@is_dir($dir)) {
            throw new PageCacheException(__METHOD__ . ': ' . (string)$dir . ' in constructor is not a directory');
        }

        // Check for trailing slash and add it if not exists
        if (mb_substr($dir, -1, 1) !== DIRECTORY_SEPARATOR) {
            $dir .= DIRECTORY_SEPARATOR;
        }

        $this->dir = $dir;
    }
917390
public function setCacheDir($dir)
	{
		$this->cacheDir = rtrim($dir, '/\\').DIRECTORY_SEPARATOR;
		if (is_writable($this->cacheDir) === false) {
			throw new Dwoo_Exception('The cache directory must be writable, chmod "'.$this->cacheDir.'" to make it writable');
		}
	}
359415
public function enableFileCaching($cacheDirectory)
    {
        $this->cacheStack[] = ['name' => 'files', 'class' => new FileCache($cacheDirectory)];
        $this->cacheDepth = count($this->cacheStack);
    }
855829
public function warmUp($cacheDir)
    {
        $locator      = $this->locator->getLocator();
        $allTemplates = $this->finder->findAllTemplates();
        $templates    = [];
        foreach ($allTemplates as $template) {
            $this->locateTemplate($locator, $template, $templates);
        }
        
        $this->writeCacheFile($cacheDir . '/templates.php', sprintf('<?php return %s;', var_export($templates, true)));
    }
1296318
public function warmUp($cacheDir)
    {
        foreach ($this->finder->findAllGeneratorYamls() as $yaml) {
            try {
                $this->buildFromYaml($yaml);
            } catch (GeneratedModelClassNotFoundException $e) {
                echo ">> Skip warmup ".$e->getMessage()."\n";
            }
        }
    }
680290
public function warm()
    {

        // prepare the caches for the statements
        foreach ($this->repository->findAll() as $product) {
            // add the product to the cache, register the SKU reference as well
            $this->repository->toCache(
                $product[$this->repository->getPrimaryKeyName()],
                $product,
                array($product[MemberNames::SKU] => $product[$this->repository->getPrimaryKeyName()])
            );
        }
    }
463992
protected function _engineRender($engines, $viewPath, $silence, $mustClean, $cache)
    {
        $basePath = $this->_basePath;
        $notExists = true;

        if (is_object($cache)) {
            $renderLevel = intval($this->_renderLevel);
            $cacheLevel = intval($this->_cacheLevel);
            if ($renderLevel >= $cacheLevel) {
                if ($cache->isStarted() === false) {
                    $viewOptions = $this->_options;
                    if (is_array($viewOptions)) {
                        if (isset($viewOptions['cache'])) {
                            $cacheOptions = $viewOptions['cache'];
                            if (is_array($cacheOptions)) {
                                if (isset($cacheOptions['key'])) {
                                    $key = $cacheOptions['key'];
                                }
                                if (isset($cacheOptions['lifetime'])) {
                                    $lifeTime = $cacheOptions['lifetime'];
                                }
                            }

                            if (!isset($key) || !$key) {
                                $key = md5($viewPath);
                            }

                            if (!isset($lifeTime)) {
                                $lifeTime = 0;
                            }

                            $cachedView = $cache->start($key, $lifeTime);
                            if (!$cachedView) {
                                $this->_content = $cachedView;
                                return null;
                            }
                        }

                        if (!$cache->isFresh()) {
                            return null;
                        }
                    }
                }
            }
        }
        $viewParams = $this->_viewParams;
        $eventsManager = $this->_eventsManager;

        foreach ($engines as $extension => $engine) {
            $viewEnginePath = $basePath . $this->resolveFullViewPath($viewPath) . $extension;

            if (file_exists($viewEnginePath)) {
                if (is_object($eventsManager)) {
                    $this->_activeRenderPath = $viewEnginePath;
                    if ($eventsManager->fire("view:beforeRenderView", $this, $viewEnginePath) === false) {
                        continue;
                    }
                }
                $engine->render($viewEnginePath, $viewParams, $mustClean);

                $notExists = false;
                if (is_object($eventsManager)) {
                    $eventsManager->fire("view:afterRenderView", $this);
                }
                break;
            }
        }
        if ($notExists) {
            if (is_object($eventsManager)) {
                $this->_activeRenderPath = $viewEnginePath;
                $eventsManager->fire("view:notFoundView", $this, $viewEnginePath);
            }

            if (!$silence) {
                throw new Exception(sprintf("View %s was not found in the views directory", $viewEnginePath));
            }
        }
    }
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;
	}
207942
protected function _getCachedOrRender($viewFileName) {
		$path = str_replace(APP, '', $viewFileName);

		$prefix = Configure::read('Cache.prefix');
		if ($prefix) {
			$path = $prefix . '_' . $path;
		}

		$cacheFolder = CACHE . 'views' . DS;
		if (Configure::read('debug') && !is_dir($cacheFolder)) {
			mkdir($cacheFolder, 0770, true);
		}

		$cacheFile = $cacheFolder . Inflector::slug($path);

		if (file_exists($cacheFile)) {
			$cacheContent = $this->extractCacheContent($cacheFile);
			$cacheTime = $cacheContent['time'];

			if ($cacheTime < time() && $cacheTime !== 0) {
				unlink($cacheFile);
			} else {
				return $cacheContent['content'];
			}
		}

		$content = $this->_render($viewFileName);
		$content = $this->_compress($content);

		$cacheContent = '<!--cachetime:' . (int)$this->_duration . '-->' . $content;

		file_put_contents($cacheFile, $cacheContent);

		return $content;
	}
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);
    }
388470
public function cachedCompiler($outputDir = '', $debug = false)
    {
        $outputDir = $outputDir ?: CACHE . 'asset_compress' . DS;
        $debug = $debug ?: Configure::read('debug');

        return parent::cachedCompiler($outputDir, $debug);
    }
77975
public function setCacheDir($dir)
    {
        $this->cacheDir = rtrim($dir, '/\\') . DIRECTORY_SEPARATOR;
        if (!file_exists($this->cacheDir)) {
            mkdir($this->cacheDir, 0777, true);
        }
        if (is_writable($this->cacheDir) === false) {
            throw new Exception('The cache directory must be writable, chmod "' . $this->cacheDir . '" to make it writable');
        }
    }
599615
public function parse(array $dirs, $cacheDir = null)
    {
        $results = $this->parseFiles($dirs, '/\.php$/', $cacheDir);
        $classes = [];

        foreach ($results as $refs) {
            foreach ($refs as $className => $ref) {
                $classes[$className] = $ref;
            }
        }

        return $classes;
    }
44924
public function warmUp($cacheDir)
    {
        $sql = "SELECT name FROM sysobjects WHERE type = 'U' AND name = ?";
        $stmt = $this->pdo->prepare($sql);
        $stmt->bindValue(1, $this->dbOptions['db_table']);
        $stmt->execute();
        
        if (! $stmt->fetch()) {
            $sql = "CREATE TABLE " . $this->dbOptions['db_table'] . " (" . $this->dbOptions['db_id_col'] . " VARCHAR(" . $this->dbOptions['db_id_length'] . ") PRIMARY KEY NONCLUSTERED, " . $this->dbOptions['db_data_col'] . " NVARCHAR(MAX), " . $this->dbOptions['db_time_col'] . " INT)";
            $this->pdo->exec($sql);
            
            $sql = "CREATE CLUSTERED INDEX sess_time_idx ON " . $this->dbOptions['db_table'] . " (" . $this->dbOptions['db_time_col'] . ")";
            $this->pdo->exec($sql);
        }
    }
359718
private function generateTemplateMapper($cacheDir)
    {
        $files = $this->templateUtil->getAllTemplates();

        if (empty($files)) {
            return;
        }

        $this->filesystem->dumpFile(
            $cacheDir.'/contao/config/twig-templates.php',
            sprintf("<?php\n\nreturn %s;\n", var_export($files, true))
        );
    }
368731
public static function getCachingClient($cacheDir = null)
	{
		$client = new Cached(self::getClient());
		$client->cacheDir = (isset($cacheDir)) ? $cacheDir : sys_get_temp_dir();

		return $client;
	}