[TYPO3-english] my own backend class in caching framework

Christian Kuhn lolli at schwarzbu.ch
Wed May 25 09:12:48 CEST 2011


Hey,

On 05/25/2011 07:56 AM, Tomasz Krawczyk wrote:
> I would like to make some tests. I wrote a backend class basing on APC
> backend. I would like to add my own backend class to caching framework?
>
> I added my class in localconf.php to
> $TYPO3_CONF_VARS['SYS']['caching']['cacheBackends']

ext_localconf.php of your extension with the new backend:

$TYPO3_CONF_VARS['SYS']['caching']['cacheBackends']['tx_myext_cache_backend_MySpecialBackend'] 
= 'tx_myext_cache_backend_mySpecialBackend';

 > $TYPO3_CONF_VARS['SYS']['cacheConfigurations']
 > array in the same file.


ext_localconf.php of your extension with the new backend, or alternative 
localconf.php (the is_array check is obsolete in localconf.php):

if 
(!is_array($TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['cache_myext_foocache'])) 
{
	$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['cache_mycache_foocache'] = array(
		'frontend' => 't3lib_cache_frontend_StringFrontend',
		'backend' => 'tx_myext_cache_backend_mySpecialBackend',
	);
}


ext_autoload.php of you extension:
$extensionPath = t3lib_extMgm::extPath('myext');
array(
	.....
	'tx_myext_cache_backend_myspecialbackend' => $extensionPath . 
'classes/class.tx_myext_cache_backend_myspecialbackend',
);


All untested, but those are the main parts, example can be found in 
ext_enetcache, which registers a compressing db backend for 4.3 & 4.4, 
before the core implementation was able to do it as well. Be aware that 
the class registering in ['cacheConfiguration'] is slightly different in 
4.3 and 4.4 (full path instead of using autoloader).

Regards
Christian


More information about the TYPO3-english mailing list