[TYPO3-mvc] Caching problem?

Franz Koch typo3.RemoveForMessage at elements-net.de
Tue Mar 22 15:13:24 CET 2011


Hey Xavier,

> Just to freshen the ideas, I have a very basic plugin with 3 actions:
>
> - index (listing of some records, each record is linked to the edit action)
> - edit (edit form of a record)
> - update (actual update of the record, when the edit form is submitted)
>
> index action is cached, edit/update actions are not cached.
...
> As the edit action is not cached, the link seems to look good (no cHash
> which would make the action "cached") BUT the page is normally cached
> (index action) and as such, as there is no cHash, TYPO3 serves the very
> same page it has in cache, thus the index action!
...
> After commenting out this whole block, my edit links are generated with
> a cHash which forces TYPO3 to invoke Extbase again, thus the
> handleRequest() method and then the plugin is properly invoked.
>
> What happens: when generating 'edit' action links,
>
> $actionName = 'edit';
> $this->useCacheHash is TRUE and isActionCacheable() call returns FALSE
> because 'edit' cannot be cached, OK but as the current action is cached,
> the cHash which is used for cached actions is removed and TYPO3 does not
> invoke handleRequest() anymore as it can be served from cache.
>
> I don't really like having a cHash for a non-cached action but I don't
> want either to have to go to Extbase dispatcher over and over again in
> case the plugin is cached.

I know about that issue - already discussed that with Bastian. So do you 
see any good solution form your side?

The mentioned snippet in the UriBuilder got implemented after a feature 
request to remove the cHash on nonCached uris, which is correct behavior 
and should be kept. If we'd always append the cHash, the very same page 
would be added several times to the page cache although it's content is 
set to USER_INT and isn't even part of the cached page. So this is also 
a no-go.

The only "solution" I currently see for mixed (cached/noncached) plugins 
displayed on the same page would be to check if the default action is 
cached, and if so always add a cHash in case it's a link to the same 
pageUid. This will of course also add unnecessary entries to the page 
cache, but at least not for all scenarios.

Or is there a hook in TYPO3 we could use to manipulate the cache 
handling? Didn't have a look yet. The ideal solution would be to only 
have one version in the page cache for all USER_INT actions independent 
of their parameters/cHash.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list