/** * @param array $params * @param FrontendInterface $frontend */ public function set($params, $frontend) { /* We're only intrested in the page cache */ if ($frontend->getIdentifier() !== 'cache_pages') { return; } $data = $params['variable']; $tags = $params['tags']; $lifetime = $params['lifetime']; $uri = GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'); $temp_content = isset($data['temp_content']) && $data['temp_content']; $tsfe = $this->getTypoScriptFrontendController(); $cachable = $temp_content === false && $tsfe->isStaticCacheble() && $tsfe->doWorkspacePreview() === false && strpos($uri, '?') === false && in_array('nginx_cache_ignore', $tags) === false; if ($cachable) { $this->getCacheManager()->getCache('nginx_cache')->set(md5($uri), $uri, $tags, $lifetime); } }
/** * Registers a cache so it can be retrieved at a later point. * * @param \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache The cache frontend to be registered * @return void * @throws \TYPO3\CMS\Core\Cache\Exception\DuplicateIdentifierException if a cache with the given identifier has already been registered. * @api */ public function registerCache(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache) { $identifier = $cache->getIdentifier(); if (isset($this->caches[$identifier])) { throw new \TYPO3\CMS\Core\Cache\Exception\DuplicateIdentifierException('A cache with identifier "' . $identifier . '" has already been registered.', 1203698223); } $this->caches[$identifier] = $cache; }
/** * Sets a reference to the cache frontend which uses this backend * * @param \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache The frontend for this backend * @return void * @api */ public function setCache(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache) { $this->cache = $cache; $this->cacheIdentifier = $this->cache->getIdentifier(); }