Bug #59173
closedCaching group "pages" and "all" are equal
0%
Description
The caching groups "pages" and "all" both clear the same caches:
- cache_hash
- cache_pages
- cache_pagesection
- cache_rootline
The "system" caching group does not clear any of these caches. It clears the following:
- cache_core
- cache_classes
- l10n
- cache_phpcode
- extbase_object
- extbase_reflection
- extbase_typo3dbbackend_tablecolumns
- extbase_typo3dbbackend_queries
- extbase_datamapfactory_datamap
- fluid_template
As a developer this is very confusing. There are two options which do the same and "all" does not clear the other options like it did in previous TYPO3 versions. If I change something in a cachable extension, I need to clear two caches: all and system.
Additionally "system" does not appear for admins, when the server does not run in development mode. So if I have changes to an extbase extension, and push the changes to the server, I cannot flush the cache in the backend and get erros in the frontend.
Updated by Markus Klein over 10 years ago
Hi!
Thanks for you findings. This is indeed very interesting.
You can add the button for clearing the system cache via user TSconfig.
Updated by Robert Vock over 10 years ago
Yes, I added the option for my admin user:
options.clearCache.system = 1
But I need to remember to set this for every new TYPO3 installation and it's confusing that "all caches" does not clear all caches.
Updated by Markus Klein over 10 years ago
Where does it say "all caches"? The name of the cache group is "all" and that's not so good.
Why do you need to add this for every installation?
While setting up a site you're probably in dev-context, so the button is there.
Once the site goes live, you most probably will not touch things that affect the system cache.
Updated by Robert Vock over 10 years ago
Oh, it did not say "all caches". Just the caching group is named "all".
Our staging servers also do not run in dev-context to test the site with production settings. Also after the site goes live, there might be some changes afterwards. To make sure these work correctly, I now have to clear two caches instead of one after I perform a code update of an extension. To be able to clear both caches I need to add this TSconfig setting to every installation or the button is not there.
I will probably update our scaffolding scripts to do that.
Updated by Philipp Gampe over 10 years ago
- Status changed from New to Rejected
The cache group all
exists for backwards compatibility reasons and includes all caches without a cache group set and of course all caches that are included in the all
group.
The core caches in pages
are also included in all
, but this does not have to be this way. You can remove them from there and you can add caches to pages
cache without adding them to the all
cache.
You may define your own cache group for your custom extensions. And of course you can add the system
caches to the all
group to have them cleared on all
.
This is also described in the News.txt file: https://git.typo3.org/Packages/TYPO3.CMS.git/blob/30b091ae307f55581e7e1418891d0e81cf85ccee:/NEWS.md#l105
Therefore this is not a bug, but a misconception. The word "all" is a bit ugly in this context, but IMHO still the most fitting term for the generic group and includes all custom groups and old-style caches.
Updated by Robert Vock over 10 years ago
Philipp Gampe wrote:
And of course you can add the
system
caches to theall
group to have them cleared onall
.
How do I add the system
caches to the all
group?
I tried the following code snippet in AdditionalConfiguration.php and in ext_localconf.php of my extension:
foreach ($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'] as $key => &$data) { if (in_array('system', $data['groups']) && !in_array('all', $data['groups'])) { $data['groups'][] = 'all'; } } $cacheManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager'); $cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
Both times the caching group all
does not contain all system
caches. The cache manager only adds the cache identifier to a cacheGroup during creation of the cache:
https://git.typo3.org/Packages/TYPO3.CMS.git/blob/30b091ae307f55581e7e1418891d0e81cf85ccee:/typo3/sysext/core/Classes/Cache/CacheManager.php#l390
If I change the cachingConfiguration AFTER a cache has been created, the caching group is not updated, when I call setCacheConfigurations.
But in AdditionalConfiguration, not all cacheConfigurations are available. Only the following 11 are available:
- cache_core
- cache_classes
- cache_hash
- cache_pages
- cache_pagesection
- cache_phpcode
- cache_runtime
- cache_rootline
- l10n
- extbase_object
- extbase_reflection
In ext_localconf.php the following are available:
- cache_core
- cache_classes
- cache_hash
- cache_pages
- cache_pagesection
- cache_phpcode
- cache_runtime
- cache_rootline
- l10n
- extbase_object
- extbase_reflection
- extbase_typo3dbbackend_tablecolumns
- extbase_typo3dbbackend_queries
- extbase_datamapfactory_datamap
- fluid_template
But cache_core
and cache_classes
are already created. So changing the caching configuration for them does not add them to the all
group. To add all system
caches to the all
group, I need to run the code snippet in AdditionalConfiguration.php AND in ext_localconf.php or am I missing some easier way?
Updated by Robert Vock over 7 years ago
Just a note: This inconsistency got fixed with #75844