Story #54991

Improve caching framework by introducing groups

Added by Benni Mack almost 6 years ago. Updated about 2 years ago.

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

100%

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. :)

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


Subtasks

Task #55035: Create clear cache command to clear system cachesRejected


Related issues

Related to TYPO3 Core - Task #54984: "Clear all caches" makes the site unavailable for several seconds Closed 2014-01-14
Related to TYPO3 Core - Bug #55877: Property ListUtility::$objectManager does not exist Closed 2014-02-11
Related to TYPO3 Core - Bug #57064: New option clearCache.system does not show up Closed 2014-03-19

Associated revisions

Revision 1101f392 (diff)
Added by Benni Mack almost 6 years ago

[!!!][FEATURE] Improve caching framework by introducing groups

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 patch introduces the possibility to group caches. The core uses
two groups "pages" with all page-related caches, and "system" that
is used for compile-time caches and configuration caches.

The new API is now used to be more flexible inside DataHandler
clear_cacheCmd without having hooks, as the Cache Manager is used
to clear all caches inside one hook.

!!! The "Clear all caches" command does not flush caches for
system-related caches anymore. Only "Clear Configuration Cache" or
inside the install tool in the backend removes all the system caches.

A new userTSconfig option is used to non-admins to be allowed to
clear the system caches.

Resolves: #54991
Releases: 6.2
Change-Id: Ie0fe134102882a1fcc5a85a0199016cdfbda08bf
Reviewed-on: https://review.typo3.org/26829
Reviewed-by: Helmut Hummel
Reviewed-by: Wouter Wolters
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Tested-by: Helmut Hummel

History

#2 Updated by Gerrit Code Review almost 6 years ago

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26829

#3 Updated by Gerrit Code Review almost 6 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26829

#4 Updated by Gerrit Code Review almost 6 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26829

#5 Updated by Gerrit Code Review almost 6 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26829

#6 Updated by Gerrit Code Review almost 6 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26829

#7 Updated by Gerrit Code Review almost 6 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26829

#8 Updated by Gerrit Code Review almost 6 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26829

#9 Updated by Benni Mack almost 6 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

#10 Updated by Riccardo De Contardi about 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF