[TYPO3-calendar] Caching: Smart Invalidation?!
Thomas Kowtsch
thomas at kowtsch.de
Mon Aug 8 20:20:17 CEST 2011
Hi Stephan,
On 08.08.2011 07:58, Stephan Helten wrote:
>> 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).
At least, cal should not fail if one of these constraints fails.
One additional thing we should discuss with Mario is that I'd like to
see a config switch to turn this on/off.
> 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);
> }
Mmmmh... two more questions / thoughts:
- This helps on changing events, but what about new events? Does anyone
here has an idea how to clear cached pages with the corresponding
day(s)? (that was my first thought while writing my previous post
regarding the hash calculation...))
- We should not forget to implement this also for FE edit. ;-)
> 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?!
"It depends" :-)
For a fast solution (and maybe even getting some feedback from more
users), a separate extension in TER would help - we did not even start
working on v1.5, and 1.4.2 is a bugfix release only.
On the other hand, it sounds to me as if it would be beneficial for all
cal users. So, could you give it try and file a feature request in the
bugtracker [1] and tag it initial for v1.5?
Your help on this topic could really help to speed up cal in daily
business :-)
Regards,
Thomas
[1] http://svn.webempoweredchurch.org/projects/calendar/issues
More information about the TYPO3-project-calendar
mailing list