[Typo3] toggle caching inside USER content object code

Ernesto Baschny [cron IT] ernst at cron-it.de
Fri Oct 21 17:12:36 CEST 2005


Sean Ellis schrieb am 17.10.2005 19:20:

> can I do this?
> 
> I have some content provided by a php script. Sometimes it ought to be
> cached, and sometimes, depending on the records retrieved, not. I think
> that I've read about this, but can't remember where; what should I be
> looking at to toggle caching inside a USER or USER_INT script?

If you want your content being cached by TYPO3 (as part of a page), you
*have* to be an USER-object. Inside an USER object you can also tell
TYPO3 not to cache anything on this particular call (set_no_cache).

But the problem is: Once your output is cached by TYPO3, your plugin
won't be called again, except when the TYPO3-Page-Cache expires (after
0:00 on most setups, or when some other record on that page is changed,
or when the admin clears the front-end cache).

So the best solution depends on the data you are referring to. If you
want the data to be cached, but you want/need TYPO3 always to call your
script, you have to create an USER_INT plugin, and do the caching on
your own! TYPO3 already provides you with a "general purpose cache",
check out the functions t3lib_pageSelect::storeHash() and
t3lib_pageSelect::getHash().

Cheers,
Ernesto



More information about the TYPO3-english mailing list