[BUGFIX] Remove duplicate PageTS cache in Typo3DbBackend 51/54151/3
authorAlexander Schnitzler <git@alexanderschnitzler.de>
Sun, 17 Sep 2017 10:02:11 +0000 (12:02 +0200)
committerSusanne Moog <susanne.moog@typo3.org>
Wed, 20 Sep 2017 14:49:07 +0000 (16:49 +0200)
The Typo3DbBackend fetches PageTS via BackendUtility::getPagesTSconfig
and then stores a copy of it (for each page separately) in a static
property. This is a bug and leads to performance decreases because
the PageTS is already cached via BackendUtility::getPagesTSconfig
and it's done even better than in Typo3DbBackend because the backend
utility store a single cache entry for different pages with the same
PageTS. The Typo3DbBackend does create a copy of the PageTS for each
page.

Resolves: #82496
Releases: master, 8.7
Change-Id: I61bd6fa8eb3ba29baea355ae01a8d71f7ae7e963
Reviewed-on: https://review.typo3.org/54151
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php

index e7c2257..d43a3bd 100644 (file)
@@ -52,13 +52,6 @@ class Typo3DbBackend implements BackendInterface, SingletonInterface
     protected $pageRepository;
 
     /**
-     * A first-level TypoScript configuration cache
-     *
-     * @var array
-     */
-    protected $pageTSConfigCache = [];
-
-    /**
      * @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
      */
     protected $configurationManager;
@@ -715,11 +708,10 @@ class Typo3DbBackend implements BackendInterface, SingletonInterface
         if ($storagePage === null) {
             return;
         }
-        if (!isset($this->pageTSConfigCache[$storagePage])) {
-            $this->pageTSConfigCache[$storagePage] = BackendUtility::getPagesTSconfig($storagePage);
-        }
-        if (isset($this->pageTSConfigCache[$storagePage]['TCEMAIN.']['clearCacheCmd'])) {
-            $clearCacheCommands = GeneralUtility::trimExplode(',', strtolower($this->pageTSConfigCache[$storagePage]['TCEMAIN.']['clearCacheCmd']), true);
+
+        $pageTS = BackendUtility::getPagesTSconfig($storagePage);
+        if (isset($pageTS['TCEMAIN.']['clearCacheCmd'])) {
+            $clearCacheCommands = GeneralUtility::trimExplode(',', strtolower($pageTS['TCEMAIN.']['clearCacheCmd']), true);
             $clearCacheCommands = array_unique($clearCacheCommands);
             foreach ($clearCacheCommands as $clearCacheCommand) {
                 if (MathUtility::canBeInterpretedAsInteger($clearCacheCommand)) {