[TYPO3-core] RFC: #8515: Speed up tslib_cObj->getTreeList by caching its results

Ingo Renner ingo at typo3.org
Mon May 26 14:02:02 CEST 2008


Oliver Klee wrote:

Hi Oliver,

> I was referring to this piece of code:
> 
> +            // from time to time clean the cache from expired entries
> +            // (theoretically every 1000 calls)
> +        $randomNumber = rand(1, 1000);
> +        if($randomNumber == 500) {
> +            $this->removeExpiredCacheEntries();
> 
> If it shouldn't be random, why are you using rand() here?

ah ok, sure: This piece is not for _clearing_ the cache, but for 
_cleaning_ the cache.

When setting a stop time for a page the cached results containing that 
page must invalidate at the same time the page turns invisible of 
course. That's why there is an "expires" column in the cache table. So 
that part "automatically" cleans up those expired entries from time to 
time - theoretically every 1000s call.

>> no, comments are indented with one tab as I did it.
> 
> 
> IIRC we voted that the comments should be aligned with the code, not 
> indented. Do I remember this wrong?

most likely in this case - it is done that way nearly everywhere in the 
core.


Ingo

-- 
Ingo Renner
TYPO3 Core Developer, Release Manager TYPO3 4.2


More information about the TYPO3-team-core mailing list