[TASK] Add default TypoScript setting for extbase query cache 63/29763/4
authorMarc Bastian Heinrichs <typo3@mbh-software.de>
Fri, 25 Apr 2014 11:54:40 +0000 (13:54 +0200)
committerXavier Perseguers <xavier@typo3.org>
Wed, 11 Jun 2014 15:11:42 +0000 (17:11 +0200)
The extbase query cache is enabled by default. This patch
adds a TypoScript setting to enable or disable the cache in general
and on a plugin level.

Resolves: #57280
Releases: 6.2
Change-Id: I620a3c4d2c4e508630d97731f12cc11c617aae75
Reviewed-on: https://review.typo3.org/29763
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Wouter Wolters
Reviewed-by: Marcin SÄ…gol
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
typo3/sysext/extbase/Classes/Persistence/Generic/QueryFactory.php
typo3/sysext/extbase/Classes/Persistence/Generic/Typo3QuerySettings.php
typo3/sysext/extbase/ext_typoscript_setup.txt

index 13ff3b1..fc9c34e 100644 (file)
@@ -68,6 +68,9 @@ class QueryFactory implements QueryFactoryInterface, \TYPO3\CMS\Core\SingletonIn
 
                $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
                $querySettings->setStoragePageIds(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $frameworkConfiguration['persistence']['storagePid']));
+               if ($querySettings instanceof Typo3QuerySettings) {
+                       $querySettings->useQueryCache($frameworkConfiguration['persistence']['useQueryCache']);
+               }
                $query->setQuerySettings($querySettings);
                return $query;
        }
index 6f6ebaa..dde6283 100644 (file)
@@ -407,7 +407,7 @@ class Typo3QuerySettings implements QuerySettingsInterface {
         * @return QuerySettingsInterface
         */
        public function useQueryCache($useQueryCache) {
-               $this->useQueryCache = $useQueryCache;
+               $this->useQueryCache = (bool)$useQueryCache;
                return $this;
        }
 
@@ -415,6 +415,6 @@ class Typo3QuerySettings implements QuerySettingsInterface {
         * @return bool
         */
        public function getUseQueryCache() {
-               return (bool)$this->useQueryCache;
+               return $this->useQueryCache;
        }
 }
index 2cd5a16..63b741c 100644 (file)
@@ -10,6 +10,7 @@ config.tx_extbase {
        persistence{
                enableAutomaticCacheClearing = 1
                updateReferenceIndex = 0
+               useQueryCache = 1
                classes {
                        TYPO3\CMS\Extbase\Domain\Model\FileMount {
                                mapping {