[TYPO3-mvc] Caching problem?

Dmitry Dulepov dmitry.dulepov at gmail.com
Wed Mar 23 08:57:08 CET 2011


Hi!

Xavier Perseguers wrote:
> This happens in the FE Request handler [1], in method handleRequest().
> Whenever a call to isCacheable() returns FALSE, then the plugin is
> transformed into a USER_INT and, as such, will be re-rendered each time
> the page is generated.

I checked the code. The approach there may work if it is adjusted a little. 
Let me explain why and how.

Firsts, about caching and the issue happens.

When you come to the page in the cached action, Extbase checks if action is 
cacheable or not. If it is cacheable, Extbase does not call that function. 
Thus the content of the page is cached completely.

Next time when the page is called, the behavior depends on the existence of 
cHash in the URL. If there were no cHash, handleRequest() will not be 
called (because the content is taken from cache) and the content of the 
index action will be displayed.

If cHash is there, the plugin will be converted to USER_INT and stored 
properly. This is a unforeseen and unusual use of cHash because normnally 
cHash should not be used with USER_INT plugins. However there is no other 
way if somebody uses convertTouserIntObject() dynamically like Extbase 
does. I must say: the approach is ok, it is just unforeseen and was unused 
before now.

Initially convertToUserIntObject() was not meant for dynamic conversion 
between USER object types. Its only purpose was to help extensions like 
tt_news, who has "no_cache" option in TS. Usually such extensions called 
$TSFE->set_no_cache() and you know it is terrible for performance. 
Converting to USER_INT is much cheaper. But than the whole plugin runs all 
the time as USER_INT (no playing with cHash necessary).

Normally, the extension, which uses conversion, should generate links like 
this:

-------------------
$conf = array(
	'parameter' => ...,
	'useCacheHash' => $this->cObj->getUserObjectType() == 
tslib_cObj::OBJECTTYPE_USER
);
$link = $this->cObj->typolink_URL($conf);
-------------------

But in case of Extbase there must be always a cHash if there are cached and 
non-cached actions. It would be a good optimization to really check if 
there are two types of actions in the same plugin. But I am not sure if it 
is possible because links are generated by FLUID, which is a separate 
extension.

Feel free to ask questions.

-- 
Dmitry Dulepov
TYPO3 core&security team member
E-mail: dmitry.dulepov at typo3.org
Web: http://dmitry-dulepov.com/


More information about the TYPO3-project-typo3v4mvc mailing list