CoreCommunity ExtensionsIncubatorDistributionsTYPO3 4.5 ProjectsTYPO3 4.6 ProjectsTYPO3 4.7 ProjectsTYPO3 6.0 ProjectsTYPO3 6.1 ProjectsTYPO3 6.2 Projects (+)

Manual

Main objective of ttnewscache_cleartag is to manage tt_news caching. Its most effective on sites with large tt_news installations, but can work for smaller sites as well.

How it Works

When a new tt_news is created, ttnewscache_cleartag will clear cache only on pages that are affected by the change. Likewise, if a tt_news record is updated or deleted, only the affected pages will get cache cleared.

The extension requires TYPO3 4.3 to run due to the new caching system. This allows to store tags associated with tt_news records in cache, and then clear cache entries by tags. That's precisely what ttnewscache_cleartag does.

Extending ttnewscache_cleartag

There are several ways that the extension functionality can be extended.

Clearing cache from other extensions
Sometimes you may need to clear cache after performing some manipulations. you can clear cache for a specific tt_news category using:
if (t3lib_extMgm::isLoaded('ttnewscache_cleartag')) {
> $cacheObject = t3lib_div::makeInstance('tx_ttnewscacheClearTag_tcemain');
> $cacheObject->flushListCache(array($category));
}

Hooking into ttnewscache_cleartag

You could use this to clear custom caches when tt_news records change, triggering page cache clear.
In ext_localconf.php, add the following line, changing the path and class names to your values:

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ttnewscache_cleartag']['clearCache'][] = 'EXT:my_ext/class.tx_myext_cache.php:tx_myext_cache';

The class tx_myext_cache can implement the following methods:

processDatamap_afterDatabaseOperations(&$this, &$params);

Executed right after the default cache clearing actions complete. $params contains all parameters received from TCEMain. See class.tx_ttnewscachecleartag_tce for more info.

flushSingleCache(&$this, $id);

$id contains the UID of tt_news record. See class.tx_ttnewscachecleartag_tce for more info.

h3.flushListCache(&$this, $categories);

$categories contains an array of tt_news categories. See class.tx_ttnewscachecleartag_tce for more info.