flushByTag() публичный Метод

Flush content cache entries by tag
public flushByTag ( string $tag ) : integer
$tag string A tag value that was assigned to a cache entry in TypoScript, for example "Everything", "Node_[…]", "NodeType_[…]", "DescendantOf_[…]" whereas "…" is the node identifier or node type respectively
Результат integer The number of cache entries which actually have been flushed
 /**
  * Flush caches according to the previously registered node changes.
  *
  * @return void
  */
 public function shutdownObject()
 {
     if ($this->tagsToFlush !== array()) {
         foreach ($this->tagsToFlush as $tag => $logMessage) {
             $affectedEntries = $this->contentCache->flushByTag($tag);
             if ($affectedEntries > 0) {
                 $this->systemLogger->log(sprintf('Content cache: Removed %s entries %s', $affectedEntries, $logMessage), LOG_DEBUG);
             }
         }
     }
 }
Пример #2
0
 /**
  * @test
  */
 public function exceptionInAlreadyCachedSegmentShouldNotLeaveSegmentMarkersInOutput()
 {
     $object = new TestModel(42, 'Object value 1');
     $view = $this->buildView();
     $view->setOption('enableContentCache', true);
     $view->setTypoScriptPath('contentCache/nestedCacheSegmentsWithConditionalException');
     $view->assign('object', $object);
     $view->assign('throwException', false);
     $firstRenderResult = $view->render();
     $this->assertEquals('Cached segment|counter=1|It depends|End segment', $firstRenderResult);
     $this->contentCache->flushByTag('Inner');
     $view->assign('throwException', true);
     $secondRenderResult = $view->render();
     $this->assertStringStartsWith('Cached segment|counter=1|Exception', $secondRenderResult);
 }