[TYPO3-dev] set_no_cache is bad. What's next?

Steffen Kamper steffen at dislabs.de
Thu Mar 29 23:21:04 CEST 2007


Hi Franz,

"Franz Holzinger" <franz at fholzinger.com> schrieb im Newsbeitrag 
news:mailman.1.1175202188.17206.typo3-dev at lists.netfielders.de...
> Hello John Angel,
>
>>> set_no_cache() for me (back then) did mean no caching for
>>> the current extension, instead of no caching for the entire page.
>>
>> Is it possible to temporary disable caching of the current extension,
>> but to keep caching of the rest of the page? E.g. for polls ext.
>>
>> Something like switching from USER_INT to USER object in the fly?
>>
> E.g. tt_board is usually a USER object. So everything is cached by 
> default.
>
> But if someone has submitted new text, then this should be shown
> immediately to all the others who will in the near future visit this
> page or a list page above.
>
> This is done by this command:
>
> $this->clear_cacheCmd(intval($this->newData['tt_board']['NEW']['pid']));
>
> or
> $this->clear_cacheCmd($pid);
>
> /**
> * Form-data processing class.
> **/
>
> tslib_feTCE::
>
> /**
> * Clear cache for page id.
> * If the page id is the current page, then set_no_cache() is called (so
> page caching is disabled)
> *
> * @param integer The page id for which to clear the cache
> * @return void
> * @see tslib_fe::set_no_cache()
> */
> function clear_cacheCmd($cacheCmd) {
> $cacheCmd = intval($cacheCmd);
> if ($cacheCmd) {
> $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages',
> 'page_id='.intval($cacheCmd));
> if ($cacheCmd == intval($GLOBALS['TSFE']->id)) { // Setting no_cache
> true if the cleared-cache page is the current page!
> $GLOBALS['TSFE']->set_no_cache();
> }
> }
> }
>
>
> So the set_no_cache is still needed.
> Normally all the tt_board pages are cached and this should be like this.
> Only sometimes when somebody enters a new post, then the pages showing
> it must be cleared from cache. It would be no good solution if it would
> be necessary to turn the caching totally off for the tt_board extension.
> I cannot see any improvement in deleting the set_no_cache function. It
> should remain but be enhanced to only delete the parts of the cache
> belonging to an extension. The entered texts will normally remain the
> same until someone, may only once in a month, wants to change them.
>
>
> - Franz
>
>

why not using TYPO3-Method ?

$TCE = t3lib_div::makeInstance('t3lib_TCEmain');
$TCE->admin = 1;
$TCE->clear_cacheCmd('pages');
$TCE->clear_cacheCmd($pid);you don't need set_no_cache() really ;-)vg 
Steffen 






More information about the TYPO3-dev mailing list