[TYPO3-team-templavoila] Caching of xml2array during rendering
Dmitry Dulepov
dmitry.dulepov at gmail.com
Tue May 26 21:06:55 CEST 2009
Hi!
Daniel Pötzinger wrote:
> Sorry here is another patch - I forgot to cache the localprocessing
A tiny note: I think "$cacheData=" is not necessary in the getXML2ArrayWithCache. Here:
+ $this->updateCacheForRow($row['uid'], $table, $fieldwithxmlCache, $cacheData=array('tstamp'=>$row['tstamp'], 'data'=>$data ));
Did you use it for debugging? :)
The patch is a bit off the CGL with spaces but I can live with that :) In general spaces should be around all operators (i.e. $hello = 'world') and not before ')'. But that's just my rant... I think the patch is very useful. I one tried to profile the FE and xml2array is really a time eater.
I did not test the patch, only looked. I think it is good to integrate it. One thing that can be a problem is this:
+ $cacheData=@unserialize($row[$fieldwithxmlCache]);
+ if ($cacheData['tstamp'] == $row['tstamp']) {
If I remember correctly, than this causes a PHP runtime error if $cacheData is not an array but boolean (or string). It happened in the past a lot in TCEforms when '<meta></meta>' was decoded as a string while the code expected it to be an array. It says something like "cannot use string offset as array blah-blah-blah".
I suppose we need something like this:
+ $cacheData = @unserialize($row[$fieldWithXmlCache]);
+ if (is_array($cacheData) && $cacheData['tstamp'] == $row['tstamp']) {
(also spaces and camelCase).
--
Dmitry Dulepov
In the TYPO3 blog: http://dmitry-dulepov.com/article/macintosh-vs-hackintosh.html
LinkedIn: http://www.linkedin.com/in/dmitrydulepov
Twitter: http://twitter.com/dmitryd
Skype: liels_bugs
More information about the TYPO3-team-templavoila
mailing list