Story #54991

Improve caching framework by introducing groups

Added by Benni Mack over 7 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Caching
Target version:
Start date:
2014-01-15
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
TYPO3 Version:
6.2
PHP Version:
Tags:
Sprint Focus:

Description

The current TYPO3 Core includes different types of caches. There are system-related caches (class loading cache, configuration cache, l10n_cache extbase_object, extbase_reflection etc.) and frontend-related caches (chash cache, page cache, page section cache). The usability of "clear all caches" for BE users is here problematic, as TYPO3 has to set up all (!) caches again if somebody moves a page. Two important features are missing:

1) Caches that are excluded when clearing the "regular" caches.
Certain caches need to be built-up and added (no warm-up phase possible though), but only change in a development environment or if an extension is installed/uninstalled. Think of the l10n_cache - this should never be flushed in a production environment.

2) Certain core-related system caches should not have a life-time (and should not be flushed all the time), as in production mode, the template files won't change.

This shows that currently it is dealt with "page-related caches", and with "system-related caches" and they should be handled differently.

-- Implementation idea

In each Cache Configuration, there is a new "groups" parameter, that shows in which groups the cache should be included. The cache explains in what groups the cache is located. Example:

$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['cache_classes'] = array(
'backend' => 'TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend'
'frontend' => 'TYPO3\CMS\Core\Cache\Frontend\StringFrontend'
'options' => ...
'groups' => array('frontend,pages,system')
);

The cache manager, the only instance currently handling cache configurations currently, identifies when a cache is created, in which groups the cache is put and stores this in a separate new property of this cache manager.

As this is a configuration option in an array, it is possible to change groups depending on the environment, so the development environment can even set system-related caches on each page hit ;).

Things to do in the first steps:

  • add new property in CacheManager "$groups"
  • evaluate the "groups" parameter in "CacheManager->createCache()"
  • add new methods in CacheManager "flushCacheGroup($group)", "flushCacheGroupByTag($group, $tag)"
  • define groups and set groups to all cache configurations in the Core
  • replace functionality of "clear cache" in DataHandler to clear all caches, except system caches
Second step:
  • Have the icons in the page modules etc. and in the top bar not use DataHandler anymore, but use the CF directly.
  • Replace "Configuration Cache" by "System Cache" in the top toolbar.
Related steps:
  • configure default lifetime of "system" caches to unlimited lifetime

If this is done, the TYPO3 system will run extremely faster, as cache clearing is becoming "normal" again. :)


Files

caching_framework.patch (18.8 KB) caching_framework.patch Benni Mack, 2014-01-15 09:31

Subtasks

Task #55035: Create clear cache command to clear system cachesRejected2014-01-15

Actions

Related issues

Related to TYPO3 Core - Task #54984: "Clear all caches" makes the site unavailable for several secondsClosed2014-01-14

Actions
Related to TYPO3 Core - Bug #55877: Property ListUtility::$objectManager does not exist Closed2014-02-11

Actions
Related to TYPO3 Core - Bug #57064: New option clearCache.system does not show upClosedFrancois Suter2014-03-19

Actions

Also available in: Atom PDF