[Typo3-dev] Code change template cache logic

Volker Hielscher vh at dmc.de
Wed Dec 7 10:03:32 CET 2005


Hi,

i found an problem in the caching logic at high traffic sites. It's in the 
3.8 source code of the class
class.t3lib_tstemplate.php in the function start.
it ist the position where the cache is written. first the templatecache is 
deleted and after that it is insert (again).
Now it could be that 2 request come at the same time and the first one 
deletes the cache , the second want's to read it and found that there is no 
cache and brings the cache is beeing generated page to the user.
I changed the lines and now we have no probs because the data is all time 
valid.
Can someone checks the actual code and change the lines in core if you are 
agree with the change ?

change from:
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pagesection', 
'page_id='.intval($GLOBALS['TSFE']->id).' AND 
mpvar_hash='.t3lib_div::md5int($GLOBALS['TSFE']->MP));
$GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_pagesection', $insertFields);

to:
$GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_pagesection', $insertFields);
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('cache_pagesection', 
'page_id='.intval($GLOBALS['TSFE']->id).' AND 
mpvar_hash='.t3lib_div::md5int($GLOBALS['TSFE']->MP), $insertFields);

Regards
Volker Hielscher 






More information about the TYPO3-dev mailing list