[CLEANUP] Reduce cache gets in MarkerBasedTemplateService 82/52982/2
authorClaus Due <claus@namelesscoder.net>
Tue, 30 May 2017 22:42:10 +0000 (00:42 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Wed, 31 May 2017 19:52:11 +0000 (21:52 +0200)
Multiple calls to get() from cache can be condensed to one.

Change-Id: I1d949fcbc0c91afdbfb2d0e2bc3d9c1b4dfd475a
Resolves: #81385
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/52982
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Classes/Service/MarkerBasedTemplateService.php

index b897977..b9bcf99 100644 (file)
@@ -367,8 +367,9 @@ class MarkerBasedTemplateService
         }
         asort($keysToReplace);
         $storeKey = md5('substituteMarkerArrayCached_storeKey:' . serialize([$content, $keysToReplace]));
-        if ($runtimeCache->get($storeKey)) {
-            $storeArr = $runtimeCache->get($storeKey);
+        $fromCache = $runtimeCache->get($storeKey);
+        if ($fromCache) {
+            $storeArr = $fromCache;
         } else {
             $cache = $this->getCache();
             $storeArrDat = $cache->get($storeKey);