[TYPO3-core] Introducing a BE rootline cache

Martin Kutschker Martin.Kutschker at n0spam-blackbox.net
Mon Feb 26 16:07:14 CET 2007


Ingo Renner schrieb:
> 
> Am 26.02.2007 um 15:23 schrieb Martin Kutschker:
> 
> Hi Martin,
> 
>> Issue: The BE tries to get the rootline for a given page id again  and 
>> again (eg in the "new element" wizard). This create quite a  large 
>> number of unnecessary DB requests.
>>
>> Solution: Use a cache during a page request.
> 
> 
> I like yoour idea. However I think we should have one return in a  
> method only. Thus I'd like you to change it to set $output to the  
> cached array and check whether it is empty. It would then stay with  one 
> return only.

You mean:

if (cache hit?) {
  out = cache value
} else {
  do calculation
  out = result
}
return out

I hate this style ;-) IMHO it's harder to see what is going on, when there 
is only ONE EXTRA RETURN at start in a condition check. I agree that 
multiple returns scattered around in a function are harder to read.

But I don't care. I'll be happy to commit it in any style I get my +1's

Masi


More information about the TYPO3-team-core mailing list