[BUGFIX] Memory consumption in DataHandler->processClearCacheQueue 85/35085/6
authorStephan Großberndt <stephan@grossberndt.de>
Tue, 9 Dec 2014 11:17:15 +0000 (12:17 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Wed, 10 Dec 2014 00:10:24 +0000 (01:10 +0100)
Reduce memory consumption in DataHandler->processClearCacheQueue() for
bulk inserts by filling $tagsToClear as an associative array instead of
a normal array with array_unique()-call after each added record.

Resolves: #63615
Releases: master, 6.2
Change-Id: I1f557f435088cab3aa928ec3f44b0ded9265d7a7
Reviewed-on: http://review.typo3.org/35085
Reviewed-by: Lukas Krieger <lukas.krieger@me.com>
Tested-by: Lukas Krieger <lukas.krieger@me.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/core/Classes/DataHandling/DataHandler.php

index 3e58003..9c01e8a 100644 (file)
@@ -6920,13 +6920,12 @@ class DataHandler {
                                                // point to real pages and caches at all. Flushing caches for
                                                // those records does not make sense and decreases performance
                                                if ($pageId >= 0) {
-                                                       $tagsToClear[] = 'pageId_' . $pageId;
+                                                       $tagsToClear['pageId_' . $pageId] = TRUE;
                                                }
                                        }
                                        // Queue delete cache for current table and record
-                                       $tagsToClear[] = $table;
-                                       $tagsToClear[] = $table . '_' . $uid;
-                                       $tagsToClear = array_unique($tagsToClear);
+                                       $tagsToClear[$table] = TRUE;
+                                       $tagsToClear[$table . '_' . $uid] = TRUE;
                                }
                                // Clear cache for pages entered in TSconfig:
                                if (!empty($TSConfig['clearCacheCmd'])) {
@@ -6946,7 +6945,7 @@ class DataHandler {
 
                /** @var \TYPO3\CMS\Core\Cache\CacheManager $cacheManager */
                $cacheManager = $this->getCacheManager();
-               foreach ($tagsToClear as $tag) {
+               foreach ($tagsToClear as $tag => $unusedValue) {
                        $cacheManager->flushCachesInGroupByTag('pages', $tag);
                }