[TYPO3-mvc] Caching problem?

Christian Kuhn lolli at schwarzbu.ch
Fri Mar 25 22:03:10 CET 2011


Hey,

On 03/21/2011 07:00 PM, Xavier Perseguers wrote:
> When I go to website1, I see index of myplugin, can use edit and update.
> If I go to website2, I see nothing, the plugin seems not to be rendered
> at all!
>
> If I put no_cache for the _page_, then both index actions for website1
> and website2 are shown properly but edit/update do not work anymore.
>
> If I put "index" as non-cached too but remove no_cache for the page, it
> does not help either, same behavior as earlier, works on website1, not
> on website2.
>
> Any idea?

We've had similar issues, using 4.4, but with the 4.5 extbase cache 
issue http://forge.typo3.org/issues/9762 backported to our 4.4 core 
version. I guess nothing else changed in this area with 4.5 extbase.

Our scenario is that we have for example a index action that generates a 
list of items. This action is USER. But then another action on the same 
page can generate a POST or GET parameter (say a search word), that must 
be considered by index action to calculate the result list based on 
given search word.

So, we want two things: A fully cached page for usual requests on index 
action, further fully cached pages for other parameters (like a category 
selection), but a switch to USER_INT of some actions for things like 
searchwords. All that one one page.

We solved this by adding a second POST/GET parameter to the link (eg. 
"tx_enetmyext_pi[nc]=1", and set the action to USER_INT if this param is 
given, using a condition.

[globalVar = GP:tx_enetmyext_pi1|demand|nc = 1]||[globalVar = 
GP:tx_enetmyext_pi1|nc = 1]
tt_content.list.20.enetmyext_pi1.switchableControllerActions.Event.nonCacheableActions 
:= addToList(index)
[global]

Another idea is to react directly on a given searchWord parameter (the 
above is just a bit more generic):
[globalVar = GP:tx_enetsupplysource_pi1|demand|searchWord = ]
[else]
tt_content.list.20.enetmyext_pi1.switchableControllerActions.Entry.nonCacheableActions 
:= addToList(index)
# To display given searchword in search form, set it to _int as well
tt_content.list.20.enetmyext_pi1.switchableControllerActions.Entry.nonCacheableActions 
:= addToList(search)
[global]


Maybe this is still pretty much of a hack, but it seems to work for us: 
Only one page cache entry is generated for multiple search words and the 
action is dynamically set to USER_INT.
The page is not completly set to no_cache, and fluid handles csrf form 
protection correctly, too.
Those links can be realurl'd as well (it will generate additional 
chash_cache entries, but we had to hack up a little garbage collection 
for this table anyway).

To test such a scenario the admin panel helps a lot with showing the 
number of USER_INTS on a page.

My 2 cents
Christian


More information about the TYPO3-project-typo3v4mvc mailing list