[TYPO3-dev] Hook for clearing cache_pagesection

Manfred Mirsch manfred.mirsch at tandemmedia.de
Sat Jan 23 02:59:36 CET 2010


Hi Christian,
thanks for your explanations.

My solution is like this:
I use TYPO3 to render the layout including page menu.
For showing the page content I call a user function that gets the 
content with curl, does some link transformation and then returns the 
modified html.

For detecting, if the content changed I compare the timestamp of the 
cache_page_section entry with the one of the foreign page (I get the 
timestamp by database query, because that page is generated form SixCMS).

At the moment I call the rendering function as USER.
I got some of my information from the first Link you posted and some 
more from books of dimitry dulepov and the "TYPO3 Profibuch".

I use 4.3.1 could give your solution with tagging a try.

But now I tried to use determineId-PostProc and set:
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pagesection','page_id='.$typo3Id);

This seem to be the solution now.

Is it correct that I don't have to clear the db-entry of table 
'cache_page', because the rest of the page doesn't have to be rebuild?

I didn't ever use the caching framework of TYPO3.
What would be the advantage to use it?

Good night,
Manfred

> Hey,
>
> Manfred Mirsch wrote:
>> Now I am searching for a way to clean the cache of a content element
>> during the rendering process when i recognize that curl has to reload
>> the foreign page.
>>
>> I found several hooks in tslib_fe.php but no one really worked for me.
>> I tried clearing cache by deleting the corresponding entries in
>> database-tables 'cache_pages' and 'cache_pagesection' but this has only
>> effect for the next page hit.
>
> You are sure, we are talking about cache_pagesection and not cache_pages?
>
> If cache_pages:
>
> Simple solution:
> Use a USER_INT for your "get content from other site" plugin.
>
> Tricky solution:
> Maybe you could use determineId-PostProc (just guessing)? At this point
> the page id is already calculated, but the page is not retrieved from
> cache, yet. If this doesn't work out, a new hook just before cache get
> might be a useful feature for the core anyway ...
> You could do this: Use the caching framework of 4.3 and tag your "shows
> content from other site" pages with some tag. Find some (fast) logic to
> determine if your upstream page changed and drop
> cachingframework_cache_pages entries with mentioned tag. Cache lookup
> will then have a cache miss and your page is recalculated. Your "get
> content from other site" plugin is called, sets the tag and a new cache
> entry.
> For more information on TYPO3 caching and behavior you could take a look
> at documentation of enetcache [2], even if it's not designed to handle
> your specific use case.
>
>
>> Actually I didn't find the part in index_ts.php or tslib_fe.php where
>> the desicion is made,
>> if the page content is taken from cache or rendered.
>
> Take a look at [1]
>
> [1]http://buzz.typo3.org/people/stucki/article/typo3-frontend-rendering-explained/
> [2]http://forge.typo3.org/projects/show/extension-enetcache
>
> Greetings
> Christian





More information about the TYPO3-dev mailing list