[TASK] Remove has-call to caching framework in explodeSoftRefParserList 83/50783/3
authorWouter Wolters <typo3@wouterwolters.nl>
Tue, 22 Nov 2016 22:22:07 +0000 (23:22 +0100)
committerAndreas Fernandez <typo3@scripting-base.de>
Thu, 1 Dec 2016 18:57:28 +0000 (19:57 +0100)
No need to call has on the caching framework in the function
explodeSoftRefParserList. Furthermore we do not need to store false
to the runtime cache if parseList is an empty string.

Resolves: #78773
Releases: master, 7.6
Change-Id: Iaa3fae35d4d07a78eb0fde8efc892a9ddb46b974
Reviewed-on: https://review.typo3.org/50783
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/backend/Classes/Utility/BackendUtility.php

index 59ad922..f2a6534 100644 (file)
@@ -4133,10 +4133,16 @@ class BackendUtility
      */
     public static function explodeSoftRefParserList($parserList)
     {
+        // Return immediately if list is blank:
+        if ($parserList === '') {
+            return false;
+        }
+
         $runtimeCache = self::getRuntimeCache();
         $cacheId = 'backend-softRefList-' . md5($parserList);
-        if ($runtimeCache->has($cacheId)) {
-            return $runtimeCache->get($cacheId);
+        $parserListCache = $runtimeCache->get($cacheId);
+        if ($parserListCache !== false) {
+            return $parserListCache;
         }
 
         // Looking for global parsers:
@@ -4145,12 +4151,6 @@ class BackendUtility
             $parserList = implode(',', array_keys($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['softRefParser_GL'])) . ',' . $parserList;
         }
 
-        // Return immediately if list is blank:
-        if ($parserList === '') {
-            $runtimeCache->set($cacheId, false);
-            return false;
-        }
-
         // Otherwise parse the list:
         $keyList = GeneralUtility::trimExplode(',', $parserList, true);
         $output = [];