Project

General

Profile

Actions

Bug #17210

closed

Extending caching system (cache_hash)

Added by John Angel about 17 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2007-04-14
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.1
PHP Version:
4.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Benefits: removing garbage entries from cache_hash; better caching system for extensions.

We should introduce two new fields in table cache_hash:
- parent table
- record id of parent table

These fields describe the parent record which the cache entry is related to:

ALTER TABLE `cache_hash` ADD `parent_table` VARCHAR NOT NULL AFTER `hash`;
ALTER TABLE `cache_hash` ADD `parent_table_uid` INT UNSIGNED NOT NULL AFTER `parent_table` ;
ALTER TABLE `cache_hash` ADD INDEX `parent` ( `parent_table` , `parent_table_uid` );

In class.t3lib_page.php:

function storeHash($hash,$data,$ident)    {
$insertFields = array(
'hash' => $hash,
'content' => $data,

becomes:

function storeHash($hash,$data,$ident,$parent_table='',$parent_table_uid='')    {
$insertFields = array(
'hash' => $hash,
'parent_table' => $parent_table,
'parent_table_uid' => $parent_table_uid,
'content' => $data,

Then, we add the following code in class.t3lib_tcemain.php:5968 (Before "Delete cache for selected pages")

if(!$_params['pageIdArray']) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash',"parent_table='" . $_params['table'] . "'");
}
elseif(is_array($_params['pageIdArray'])) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash',"parent_table='" . $_params['table'] . "' AND parent_table_uid IN (" . implode(",", $_params['pageIdArray']) . ")");
}
else {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash',"parent_table='" . $_params['table'] . "' AND parent_table_uid=" . $_params['pageIdArray']);
}

Then we should change all calls to storeHash function by adding two parameters containing parent information.

E.g.

class.tslib_menu.php:842

$this->sys_page->storeHash($this->hash, serialize($this->result),'MENUDATA');

becomes:

$this->sys_page->storeHash($this->hash, serialize($this->result),'MENUDATA', 'pages', $this->id);

Warning: not all menu entries are related to 'pages' table. This was just an example how it can be used.

(issue imported from #M5425)


Files

cache_hash.patch (4.41 KB) cache_hash.patch Administrator Admin, 2007-06-25 19:20

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #17414: Rootline caching mechanismClosed2007-06-23

Actions
Actions #1

Updated by John Angel almost 17 years ago

After implementing the code above, I've noticed huge number of duplicate 'content' entries for MENUDATA, having the same parent_table and parent_table_uid, but different 'hash' value.

It seems that hash value is taking into account unnecessary values, making these duplicates (class.tslib_menu.php):

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

For the start, it seems that "serialize($this->tmpl->rootLine)" part should be changed to "serialize($this->id)".

Actions #2

Updated by John Angel almost 17 years ago

After careful analyses, I've concluded that current md5 generation of $this->hash value cannot be changed.

Anyway, garbage collector code presented above should be implemented, since cache_hash tends to grow very fast.

Actions #3

Updated by John Angel almost 17 years ago

I've submitted the patch.

Probably some parts of find_parent_pages() function can use getRootLine() function.

Actions #4

Updated by Alexander Opitz almost 11 years ago

  • Category deleted (Communication)
  • Status changed from New to Closed
  • Target version deleted (0)

With the Caching Framework a complete new caching system was introduced, so I will close this issue.

Actions

Also available in: Atom PDF