[TYPO3-dev] table cache_hash flooded

John Angel johnange at gmail.com
Thu Apr 5 19:40:03 CEST 2007


Hi,

Just looking at class.tslib_menu.php:837

$this->hash =
md5(serialize($this->menuArr).serialize($this->mconf).serialize($this->tmpl->rootLine).serialize($this->MP_array));

This shows that if rootline changes, previously generated cache entry will
never be deleted from table cache_hash, so this table will keep growing and
growing.

The bottom line: we should clear the cache entries if their parent objects
are changed (in this case: if any page in the rootline is updated, all
related cache entries should be deleted).

For the start I think we should extend the existing caching system. Let's
apply toi_cache extension concept to table cache_hash.

Existing table cache_hash has 4 fields:
- hash (unique key defining what we cache)
- content (data to cache)
- tstamp (timestamp when cache entry expires)
- ident (string identifying the type of cache, e.g. MENUDATA for system
menu)

We should introduce 2 new fields (parent table/id of cache entry):
- table
- pid

class.t3lib_page.php:function storeHash($hash,$data,$ident)

becomes:

class.t3lib_page.php:function
storeHash($hash,$data,$ident,$table='',$pid='')

Then, we make hook for
['t3lib/class.t3lib_tcemain.php']['clearPageCacheEval'], so Typo3 deletes
cache if table/pid combination is updated.

Then we change all calls to storeHash function by adding 2 parameters
containing parent id info.

Regards,
John





More information about the TYPO3-dev mailing list