From 20cea2bdab4090f498d1debd7c093baeb4143c96 Mon Sep 17 00:00:00 2001
From: Claus Due <claus@namelesscoder.net>
Date: Wed, 31 May 2017 00:42:10 +0200
Subject: [PATCH] [CLEANUP] Reduce cache gets in MarkerBasedTemplateService

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/52974
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Thomas Hohn <thomas@hohn.dk>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
---
 .../core/Classes/Service/MarkerBasedTemplateService.php      | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/core/Classes/Service/MarkerBasedTemplateService.php b/typo3/sysext/core/Classes/Service/MarkerBasedTemplateService.php
index b8979776be25..b9bcf992c436 100644
--- a/typo3/sysext/core/Classes/Service/MarkerBasedTemplateService.php
+++ b/typo3/sysext/core/Classes/Service/MarkerBasedTemplateService.php
@@ -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);
-- 
GitLab