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

Ernesto Baschny [cron IT] ernst at cron-it.de
Mon Oct 11 12:05:02 CEST 2010


Hi Christian,

Christian Kuhn schrieb am 08.10.2010 23:02:

> Ernesto Baschny [cron IT] wrote:
>> I suspect your #15940 issue for tt_news is not really valid.
>> tx_ttnews_cache::initCachingFramework() does the following:
>>
>>     $GLOBALS['typo3CacheFactory']->create(
>>         'tt_news_cache',
>>         't3lib_cache_frontend_StringFrontend',
>> $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tt_news_cache']['backend'],
>>
>>
>> $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tt_news_cache']['options']
>>
>>     );
>(...)

> Yes. But: The garbage collection task fails if there is no full
> configuration in typo3_conf_vars. Imho it's still a valid point to have
> the full definition at one central place, without hidden / hardcoded
> options somewhere.
> There could be other use case where it's needed to
> iterate and instantiate over all configured caches. And in this
> special tt_news case: If we have a fallback to VariableFrontend, the
> factory would choose the wrong frontend for tt_news (StringFrontend is
> needed here).

The t3lib_cache_Manager has the definitive list of all caches and all
its setting, because every cache has to go through "factory::create()".
So why shouldn't the garbage collector be able to go through all of
them? It shouldn't rely on some external configuration, but it should be
a method / functionality of the cache_manager itself.

If you think it shouldn't, then the cache manager should implement some
method to return an array of all caches so the GC can iterate over them.

> Now I'm confused and don't really know what's the best option: Add
> VariableFrontend as fallback in the factory, together with a
> deprecationLog() stating that this is not good and should be fixed? Or
> just throw and exception without fallback as currently done with the patch?

I think no fallback is required, as every one that needs a cache with
factory::create() will tell it which frontend is required. So your added
exception in case no frontend is given is fine.

Since adding a method to the manager (to get a list of caches) will
require some FLOW3 implementation first, you probably have to discuss
with them, if this makes sense.

Then the task to "GC" would simply do:

foreach ($GLOBALS['typo3CacheManager']->getCaches() as $cache) {
	$cache->collectGarbage();
}

What do you think?

Cheers,
Ernesto


More information about the TYPO3-team-core mailing list