Feature #18852
closedSpeed up tslib_cObj->getTreeList by caching its results
0%
Description
When extensions need to look up where their records are stored they use the startingpoint 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.
(issue imported from #M8515)
Files