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 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
- 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.
- 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. :)
[!!!][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
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.
Reviewed-by: Helmut Hummel
Reviewed-by: Wouter Wolters
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Tested-by: Helmut Hummel