[TYPO3-calendar] Caching: Smart Invalidation?!

Stephan Helten stephan.helten at engage.de
Mon Aug 8 07:58:41 CEST 2011


Hi,

> I'll need to take a closer look on how/where the cHashs are actually 
> calculated. But in any case, there is no out-of-the-box solution for 
> this problem since there is no Typo3 API for this (tsfe can only delete
cache by pid).

I think, one could use cache tags and the reg1 field for being compatible
with older typo3 verions or disabled caching framework (if support for this
is necessary).

When a detailpage is loaded this code could be executed:

if (TYPO3_UseCachingFramework) {
	// CachingFramework
	$GLOBALS['TSFE']->addCacheTags(
		array(
			'cal_details_'.intval($calDetailUid)
		)
	);
} else {
	// native caching mechanism
	$GLOBALS['TSFE']->page_cache_reg1 = intval($calDetailUid);
}

In a backend saving hook (processDatamapClass or processCmdmapClass) one
could trigger the deletion of cache entries with the same tag when a cal
record changes:

if (TYPO3_UseCachingFramework) {
	// CachingFramework
	$tags = array(
		'cal_details_'.$calUid
	);
	$pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
	$pageSectionCache =
$GLOBALS['typo3CacheManager']->getCache('cache_pagesection');
	$pageCache->flushByTags($tags);
	$pageSectionCache->flushByTags($tags);
} else {
	// native caching mechanism
	// Read pid of tt_products details page from extension configuration
	$confArray =
unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]);
	$singleViewPid = intval($confArray['PIDitemDisplay']);

	$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'reg1='.$
calUid.' AND page_id='.$singleViewPid);
} 

I would do the implementation for the details view cache invalidation like
this in an own extension, but I think it would be nice for all cal users.
I could build this into cal, if you like?!

regards

Stephan

-----Ursprüngliche Nachricht-----
Von: typo3-project-calendar-bounces at lists.typo3.org
[mailto:typo3-project-calendar-bounces at lists.typo3.org] Im Auftrag von
Thomas Kowtsch
Gesendet: Sonntag, 7. August 2011 22:17
An: typo3-project-calendar at lists.typo3.org
Betreff: Re: [TYPO3-calendar] Caching: Smart Invalidation?!

On 03.08.2011 10:54, Stephan Helten wrote:
> atm I'm using this page-tsconfig on my calendar sysfolder to invalidate
the
> cache on changes (extension clearcacheextend):
> TCEMAIN.clearCacheCmd = contains(plugin;cal;0)
> It deletes the cache of all pages containing the cal plugin.

Correct.

> Are there any smarter solutions for cache invalidation in cal?

No. Or at least: Not yet.

> E.g. invalidate only the cache of concerned parameter combinations
(cHash),
> not all dayviews at once.

I'll need to take a closer look on how/where the cHashs are actually 
calculated. But in any case, there is no out-of-the-box solution for 
this problem since there is no Typo3 API for this (tsfe can only delete 
cache by pid).


> New events are added multiple times a day, so the cache is deleted several
> times.

Is it required to have the events shown just in time of creation? 
Otherwise, you could look for a solution of a periodic cache clean...

> A call of the dayview (not cached) needs about 5 seconds, what is too
long.

Mmmh; this sounds a bit too long for me. Is this browser-dependent? I 
know that e.g. several versions of IE have really large rendering times; 
or maybe you have a complete set of all views in one page? If so, try to 
split it up into separate pages and unset all not required TS settings.

Regards, Thomas
_______________________________________________
TYPO3-project-calendar mailing list
TYPO3-project-calendar at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-calendar



More information about the TYPO3-project-calendar mailing list