Issue Bug Closed

#90905cObject caching does not respect TSFE->no_cache

Markus Klein 03/31/20, 11:21 updated 04/21/20, 10:42

Description

Problem description

We have a custom menu generation TS that looks like this

lib.mainMenu = FLUIDTEMPLATE
lib.mainMenu {
    file = EXT:sitesetup/Resources/Private/Partials/Menu.html

    cache.key.cObject = TEXT
    cache.key.cObject.value = menu_{TSFE:sys_language_uid}_{TSFE:gr_list}
    cache.key.cObject.value.insertData = 1
    cache.key.replacement {
        10 {
            search = ,
            replace = _
        }
    }
}

As you can see the menu will be cached independently of the page cache. (to avoid regenerating this huge menu for every page)

We have the problem that in FE “randomly” the menu suddenly contains access protected pages, although no user is logged in.

Analysis

Our analysis shows that the “culprit” is actually ext:solr indexing pages. If the menu cache has been flushed, solr actually generates this wrong content.
Digging deeper revealed that solr is using tsfe->no_cache=1 to avoid caching stuff in general, which is a good choice.

Unfortunately the code-part dealing with the cObject cache does not adhere to this configuration!

We checked all TYPO3 versions v8+.

Solution

Listen for tsfe->no_cache as well in the caching code for cObjects.

Reviews 3