@param           $cacheContent
@param bool|true $cacheHit

@return mixed
547035
protected function renderCacheContent($cacheContent, $cacheHit = true)
    {
        if (!($this->config['debug'] && $this->twig)) {
            return $cacheContent['Content'];
        }
        $cacheContent['lastmodify'] = time() - $cacheContent['CreatedAt'];

        return $this->twig->render(
            'TagcacheBundle:html:tagcache_debug_panel.html.twig',
            array('CacheHit' => $cacheHit, 'CacheContent' => $cacheContent, 'uniqueid' => md5(microtime() . rand()))
        );
    }
1040143
public function writeCachedContent(Smarty_Internal_Template $_template, $content)
    {
        $this->addMetaTimestamp($content);

        return $this->write(array($_template->cached->filepath => $content), $_template->cache_lifetime);
    }
1317846
private function getCacheContent($policy, $cache, &$data) {
        $policyContent = $this->tryReadFile($policy);
        $cacheContent = $this->tryReadFile($cache);
        $data = null;

        if ($policyContent === false || $cacheContent === false) {
            $this->tryDeleteFile($policy);
            $this->tryDeleteFile($cache);
            return false;
        }

        $policyEntry = json_decode($policyContent, true);

        $absoluteExpiration = (int)$policyEntry['absoluteExpiration'];

        if ($absoluteExpiration != 0 && $absoluteExpiration < time()) {
            $this->tryDeleteFile($policy);
            $this->tryDeleteFile($cache);
            return false;
        }

        $data = unserialize($cacheContent);

        return true;
    }
1131279
protected function extractResponse($zipContent)
    {
        if (!$this->cdrReader) {
            $this->cdrReader = new DomCdrReader(new XmlReader());
        }

        $xml = $this->getXmlResponse($zipContent);

        return $this->cdrReader->getCdrResponse($xml);
    }
363758
public function writeCachedContent($content)
    {
        return $this->smarty->ext->_updateCache->writeCachedContent($this->cached, $this, $content);
    }
941684
public function push( $sFileName, $mFileContent )
    {
        $sPath = $this->_getCacheFilePath( $sFileName );

        if ( is_null( $sPath ) ) {
            return false;
        }

        return file_put_contents( $sPath, serialize( $mFileContent ) );
    }
922129
protected function getTtl(string $cacheFile)
    {
        switch ($this->ttlStrategy) {
            case 'embed':
                return (int)$this->readLine($cacheFile);
            case 'file':
                return file_exists("$cacheFile.ttl")
                    ? (int)file_get_contents("$cacheFile.ttl")
                    : PHP_INT_MAX;
            case 'mtime':
                return $this->getTtl() > 0 ? filemtime($cacheFile) + $this->ttl : PHP_INT_MAX;
        }
    }
555414
protected function getMetadata($templateFileContent)
    {
        $regex                = '/\@MajoraGenerator\((.+)\)/';
        $templateFileMetadata = array('force_generation' => false);
        if (!preg_match_all($regex, $templateFileContent, $matches, PREG_SET_ORDER)) {
            return $templateFileMetadata;
        }
        foreach ($matches as $match) {
            if (null === $metadata = json_decode($match[1], true)) {
                throw new \InvalidArgumentException(sprintf(
                    'Invalid annotation json data, error %s : %s',
                    json_last_error(),
                    json_last_error_msg()
                ));
            }

            $templateFileMetadata =  array_replace_recursive(
                $templateFileMetadata,
                $metadata
            );
        }

        return $templateFileMetadata;
    }
855440
protected function replaceContent(AlSlotContent $slotContent, $content)
    {
        $regex = $this->getPattern($slotContent->getSlotName());

        return preg_replace($regex, $slotContent->getContent(), $content);
    }
1350875
private function restoreResponse(array $cacheData)
    {
        $body = null;

        if (isset($cacheData['headers']['x-content-digest'][0])) {
            $item = $this->cache->getItem($cacheData['headers']['x-content-digest'][0]);
            if ($item->isHit()) {
                $body = $item->get();
            }
        }

        return new Response(
            $body,
            $cacheData['status'],
            $cacheData['headers']
        );
    }
105455
public function cacheControl($cacheControl)
    {
        if (!($cacheControl instanceof CacheControl)) {
            $cacheControl = RequestCacheControl::fromString($cacheControl);
        }

        $this->cacheControl = $cacheControl;

        return $this;
    }
1372987
public function cacheHit($url) {
        $file = FileSystemHelper::getCachedEntry($url, $this->getCacheDir());
        return $this->isCaching() && FileSystemHelper::cacheEntryExists($file)
               && FileSystemHelper::validateCache($file, $this->getCacheTTL(),
                                                  $this->isCachingForever());
    }
749588
protected function serveFromCache($cacheFile, $hit = true)
    {
        /**
         * Cache object exists, set the appropriate headers and return the
         * contents of the file.
         **/

        $_stats = stat($this->cacheDir . $cacheFile);

        //  Set cache headers
        $this->setCacheHeaders($_stats[9], $cacheFile, $hit);

        header('Content-Type: image/png', true);

        // --------------------------------------------------------------------------

        //  Send the contents of the file to the browser
        echo file_get_contents($this->cacheDir . $cacheFile);

        /**
         * Kill script, th, th, that's all folks.
         * Stop the output class from hijacking our headers and
         * setting an incorrect Content-Type
         **/

        exit(0);
    }
220130
protected function injectContent(SlotContent $slotContent, $content)
    {
        $regex = $this->getPattern($slotContent->getSlotName());
        if (false == preg_match($regex, $content, $match)) {
            return;
        }
        $newContent = $match[1] . PHP_EOL . $slotContent->getContent();

        return preg_replace($regex, $newContent, $content);
    }
319627
protected function checkContentCache($tmplContent,$prefix='') {
        if(Storage::has(C('CACHE_PATH').$prefix.md5($tmplContent).C('TMPL_CACHFILE_SUFFIX'))){
            return true;
        }else{
            return false;
        }
    }
1310381
public function cache($file, $content, $timestamp = null)
    {
        if (!$cachePath = $this->cachePath()) {
            throw new JitException('Error, any cache path has been defined.');
        }
        $path = $cachePath . DS . ltrim(preg_replace('~:~', '', $file), DS);

        if (!@file_exists(dirname($path))) {
            mkdir(dirname($path), 0755, true);
        }

        if (file_put_contents($path, $content) === false) {
            throw new JitException("Unable to create a cached file at `'{$file}'`.");
        }
        if ($timestamp) {
            touch($path, $timestamp);
        }
        return $path;
    }
1188002
private function handleCacheListeners(RequestInterface $request, ResponseInterface $response, $cacheHit, $cacheItem)
    {
        foreach ($this->config['cache_listeners'] as $cacheListener) {
            $response = $cacheListener->onCacheResponse($request, $response, $cacheHit, $cacheItem);
        }

        return $response;
    }