[TYPO3-core] RFC #15937: Bug: [Caching framework] Improve error message if no frontend was defined for core caches

Steffen Kamper info at sk-typo3.de
Wed Oct 27 13:00:58 CEST 2010


Hi,

Ernesto Baschny [cron IT] schrieb:
> If the configuration is required anyway, we shouldn't allow the
> flexibility of creating the cache with the cacheFactory later with a
> flexible set of parameters.
> 
> E.g. first this "configuration" is declared in ext_localconf.php:
> 
> $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']
> = array(
>         'frontend' => 't3lib_cache_frontend_VariableFrontend',
>         'backend' => 't3lib_cache_backend_DbBackend',
>         'options' => array(
>                 'cacheTable' => 'tx_extbase_cache_reflection',
>                 'tagsTable' => 'tx_extbase_cache_reflection_tags',
>         ),
> );
> 
> Later on the cache is initialized with:
> 
> $GLOBALS['typo3CacheFactory']->create(
> 	'cache_extbase_reflection',
> 	$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['frontend'],
> 	$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['backend'],
> 	$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['options']
> );
> 
> See the redundancy? You have to pass again the configuration options.
> The API doesn't mandate the arguments to be exactly these
> $TYPO3_CONF_VARS settings. This is also the reason why you could not
> rely on it until now. You cannot guarantee that extensions pass exactly
> these parameters. This is only a convention until now, because the
> examples are set up in this way.
> 
> So if we stick to the standardized "configuration", we should document
> it along the API and also use it when instantiating the cache:
> 
> $GLOBALS['typo3CacheFactory']->create('cache_extbase_reflection');
> 
> No further arguments. The cacheFactory will fetch the settings from the
> configuration array (just like the "garbageCollect" task will also do).
> 
> What do you think?
> 

+1 for a right API without the complete array definition!

vg Steffen


More information about the TYPO3-team-core mailing list