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

Ingo Renner ingo at typo3.org
Mon May 26 12:06:16 CEST 2008


Hi all,

Now that trunk is back for development this is an SVN patch request.


Type: Feature/Performance Improvment (yay!)

Bugtracker reference:
http://bugs.typo3.org/view.php?id=8515

Branches: trunk

Problem:
When extensions need to look up where their records are stored they use 
the starting point selector together with the recursion level selector. 
 From these two parameters the method tslib_cObj->getTreeList() builds a 
comma separated list of page IDs where an extension should look for records.

The method does that by traversing the tree recursivly and issuing an 
SQL query for each page, depending on the recursion level set and the 
size of the tree this can result in an enormous number of SQL queries, 
time loss, and memory consumptions.


Solution:
create a cache table to store the results of tslib_cObj depending on the 
parameters the method was called with.
Now that the result is cached the cache also needs to be updated on 
certain events. These events are

* create new page
* move page
* hide/unhide/delete a page
* set/unset start/stop time for a page
* set/unset php tree stop for a page
* set/unset or change a FE group access restriction for a page

All these events would result in a different result for the getTreeList 
method, thus the cache must be cleared for these events. However for 
certain events we can find out which selected parts of the cache to 
delete and thus do not need to clear the whole cache.

Additionally the new cache will be cleared when clicking "clear all 
caches". The cache update mechanism is implemented as a hook that is now 
part of the cms system extension as it is related to pages and pages are 
part of the cms feature.


Notes:
Sponsored by snowflake productions


all the best
Ingo

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 8515.diff
Type: text/x-diff
Size: 27564 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080526/d095a429/attachment-0001.diff 


More information about the TYPO3-team-core mailing list