Oft genug hat man das Problem, das bei FE-Eingabe neuer Datensätze diese nicht sofort angezeigt werden, da das Cache nicht gelöscht wird.
Um dies zu verhindern, kann man das Cache löschen auch aus der Extension vornehmen. Der Parameter $pid gibt die ID der Seite an, dessen Cache gelöscht werden soll.
Hier der entsprechende Code dafür:
1
Seite 1 von 1
Steffen I don't think thats true:
// Clear cache
$clearCache = t3lib_div::trimExplode(',', $this->conf['additionalClearCachePages'], true);
$clearCache[] = $GLOBALS['TSFE']->id;
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
/* @var $tce t3lib_TCEmain */
foreach (array_unique($clearCache) as $pid) {
$tce->clear_cacheCmd($pid);
}
From his extension
Was ist denn mit folgender Zeile?
$GLOBALS['TSFE']->clearPageCacheContent_pidList($pidList);
Das ist ein einfacher Wrapper für eine Delete-query. Diese löscht alle Einträge in cache_pages. Cache muss auch in cache_pagesections gelöscht werden, was in tcemain passiert.
This is really bad behaviour of an extension. An extension is not allowed to clear the whole page cache. You can imagine what happens on big websites when constantly the page cache is cleared. Caching is useless then!
The second line tells TYPO3 the extension is a backend administrator (!). Never wondered why this setting is there? The third line can only be executed when the extension is an admin. The fourth line however can be done without this setting. It is better to have a TS variable like clearCacheCmdOnInsert, or something similar which contains the pid's of the pages which have to be cleared in the cache and run the fourth line for each pid.
Hi Patrick,
i agree that this is a brutal function. The Admin-User is mo problem cause it's a temp. Admin only for one thread.
The main problem is a missing API to clear detailed parts of cache, using a pidlist or a specific cHash.
If yopu look to Dmitry's tx_comments he solves it by direct sql-queries because of missing API. may be one core developer can think about creating one.