Caching and sessions · Question 10 of 12
A detail view shows the record tx_myext_item:5. If an import changes this record, the page cache of exactly these pages should become invalid. How does the controller tag the page?
1 answer is correct. Medium
Show answer
Answer
- A $request->getAttribute('frontend.cache.collector')->addCacheTags(new CacheTag('tx_myext_item_5'))
Explanation
In the frontend, the CacheDataCollector in the request attribute frontend.cache.collector collects all tags under which the page is stored. The import then uses the CacheManager to flush exactly the pages with this tag. clearPageCache() immediately flushes the cache of certain page uids but does not tag anything. $GLOBALS['TSFE'] no longer exists in TYPO3 v14.