The caching framework has been streamlined.
Registering caches for extensions and fetching the cache is much easier now.
Refactor the query cache handling in DBAL to reflect this change.
Resolves: #28805
Change-Id: I2cf1e342123ee79b6b673a5afeec4bf8d136ce8d
$this->Installer = t3lib_div::makeInstance('t3lib_install');
$this->installerSql = t3lib_div::makeInstance('t3lib_install_Sql');
-
- if (TYPO3_UseCachingFramework) {
- tx_dbal_querycache::initializeCachingFramework();
-
- try {
- $this->queryCache = $GLOBALS['typo3CacheManager']->getCache(
- 'dbal'
- );
- } catch (t3lib_cache_exception_NoSuchCache $e) {
- tx_dbal_querycache::initDbalCache();
-
- $this->queryCache = $GLOBALS['typo3CacheManager']->getCache(
- 'dbal'
- );
- }
- }
+ $this->queryCache =
+ t3lib_div::makeInstance('t3lib_cache_Manager')
+ ->getCache('dbal');
// Set internal variables with configuration:
$this->conf = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['dbal'];
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['requiredPhpModules'][] = 'EXT:dbal/class.tx_dbal_installtool.php:tx_dbal_installtool';
// Register a hook for the extension manager
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/mod/tools/em/index.php']['checkDBupdates'][] = 'EXT:dbal/class.tx_dbal_em.php:tx_dbal_em';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/mod/tools/em/index.php']['checkDBupdates'][] = 'EXT:dbal/class.tx_dbal_em.php:tx_dbal_em';
+
+ // Register caches if not already done in localconf.php or a previously loaded extension.
+if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['dbal'])) {
+ $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['dbal'] = array(
+ 'backend' => 't3lib_cache_backend_TransientMemoryBackend',
+ );
+}
+
?>
\ No newline at end of file
* @subpackage dbal
*/
class tx_dbal_querycache {
-
- /**
- * Initializes the caching framework by loading the cache manager and factory
- * into the global context.
- *
- * @return void
- */
- public static function initializeCachingFramework() {
- t3lib_cache::initializeCachingFramework();
- }
-
- /**
- * Initializes the DBAL cache.
- *
- * @return void
- */
- public static function initDbalCache() {
- try {
- if (is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['dbal'])) {
- $backend = $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['dbal']['backend'];
- $options = $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['dbal']['options'];
- } else {
- // Transient storage, will be better than nothing
- $backend = 't3lib_cache_backend_TransientMemoryBackend';
- $options = array();
- }
-
- $GLOBALS['typo3CacheFactory']->create(
- 'dbal',
- 't3lib_cache_frontend_VariableFrontend',
- $backend,
- $options
- );
- } catch (t3lib_cache_exception_DuplicateIdentifier $e) {
- // Do nothing, a DBAL cache already exists
- }
- }
-
/**
* Returns a proper cache key.
*