Oliver
Oliver

Reputation: 105

Disable "cache-disabled" in TYPO3 Log

I have developed some extensions in my typo3-instance, which gets/sends data from/to an external data-backend via an XML-interface. Obviously, caching needs to be disabled on certain pages, which display results from that interface. Unfortunately, my typo3-log gets spammed with warnings like :

cms: $TSFE->set_no_cache() was triggered. Reason: no_cache has been set before the page was generated - safety check. Caching is disabled! cms: $TSFE->set_no_cache() was triggered. Reason: config.no_cache is set. Caching is disabled!

How may I disable cache-warnings in the typo3-logger, without disabling the log completely ? Thanks in advance & best regards Oliver

Upvotes: 1

Views: 1101

Answers (1)

Claus Due
Claus Due

Reputation: 4271

You don't say where you display the data you fetched, nor do you say why the cache explicitly needs to be disabled. So this answer can only be about what you would normally do given your use case.

Normally, you would declare whichever TypoScript object that renders your custom data, as a USER_INT. This means in TYPO3 that the output from this TS object does not get rendered when a page content gets rendered. Instead, a placeholder string is added and the object will be rendered on each request, regardless which other cache instructions or cache keys were given in the URL.

This is the way you separate what gets cached from what doesn't, in the TYPO3 universe. Done this way you drastically increase performance compared to disabling the entire page cache.

In the event that your use case somehow has called for the entire page rendering to be uncached because you use the data from your custom source throughout both page and content rendering, I suggest you reconsider this and decide on a strategy which allows you to insert such values in very precise places that you can control as USER_INT.

But if you really want the application to perform well, you will instead allow TYPO3 to cache as normal and then do what is necessary to flush TYPO3 caches when your XML source gets updated, which would entail maintaining relations from TYPO3 to the XML so you can invalidate TYPO3 page caches that use a specific XML file. A hint: hooks exist which allow adding additional tags to cache entries so you could in theory add the XML filename hash as flushable tag.

Upvotes: 3

Related Questions