/** * Clears the page cache * * @param mixed $pageIdsToClear (int) single or (array) multiple pageIds to clear the cache for * @return void */ public function clearPageCache($pageIdsToClear = null) { if ($pageIdsToClear === null) { $this->cacheManager->flushCachesInGroup('pages'); } else { if (!is_array($pageIdsToClear)) { $pageIdsToClear = array((int) $pageIdsToClear); } foreach ($pageIdsToClear as $pageId) { $this->cacheManager->flushCachesInGroupByTag('pages', 'pageId_' . $pageId); } } }
/** * Flush menu cache for pages that were automatically published * between two runs of this command * * @return void */ public function clearMenuForPulishedPagesCommand() { $current = time(); $last = $this->registry->get('tx_autoflush', self::REGISTRY_KEY, $current); $pages = $this->findPagesPublishedBetween($last, $current); $pids = array(); if ($pages) { foreach ($pages as $page) { $pids[$page['pid']] = $page['pid']; } } foreach ($pids as $pid) { $this->cacheManager->flushCachesInGroupByTag('pages', 'menu_pid_' . $pid); } $this->registry->set('tx_autoflush', self::REGISTRY_KEY, $current); }
/** * Flushes caches by given tags, optionally only in a specified (single) group. * * @param array $tags * @param string $group */ public function flushByTags(array $tags, $group = NULL) { foreach ($tags as $tag) { if ($group === NULL) { $this->cacheManager->flushCachesByTag($tag); } else { $this->cacheManager->flushCachesInGroupByTag($group, $tag); } } }