[TYPO3-english] Re: Cache settings dilemma

Viktor Livakivskyi invisible.kinder at gmail.com
Mon Nov 10 14:14:11 CET 2014


Hi, Bernd 

> > Now whenever an editor adjusts a news record in the backend, all caches tagged by both, "tx_news_domain_model_news" as well as "tx_news_domain_model_news_$newsId" are flushed automatically.
> >
> > So that's not a dilemma but actually completely handled by TYPO3 internals these days. The only thing you need to do: Use prober tagging.
> 
> I don't get it.
> What is done by TYPO3 (core)? what is done by ext:news?
I've tried this in one of our extensions and can say, that Core clears the page cache by tags tx_tablename and  tx_tablename_$uid , when you save changes in tx_tablename at BE.
But, sure, these tags need to be added to the page cache from within your extension controllers. I've tried the code from example with cacheable actions - works quite good. For non-cacheable actions it doesn't make sense, so I didn't perform any checks.
I'm thinking about implemeting this in some controller init methods, like callActionMethod() or initializeAction() to avoid copy-paste.


> What needs to be configured by me?
You need the code below in your controller actions or, as I suggested above, in some init methods.
> > <pre>
> > /** @var \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $typoScriptFrontendController */
> > $typoScriptFrontendController = $GLOBALS['TSFE'];
> > $typoScriptFrontendController->addCacheTags(array( tx_news_domain_model_news', 'tx_news_domain_model_news_123'));
> > </pre>


> Can this be handled with typoscript (FE-TS, Page-TSconfig) only?
afaik, yes, you can do this with addPageCacheTags [1] in stdWrap of your plugin. Maybe, this will be more elegant, than flooding controllers with some cache stuff.
But, since you don't need tags to be added to each of your plugin instances, you may end up with bunch of TS conditions or some non-readable TS with 'if.', '.ifEmpty' and so on branches.


> can the cache be tagged and cleared with the appropiate categories?
Good question! I'd also like to know the answer.


> and following Viktor:
> where is more documentation?
+1 :)


[1]: http://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Stdwrap/Index.html#stdwrap-addpagecachetags


More information about the TYPO3-english mailing list