[TYPO3-dev] 4.7 cache.lifetime=X returns exception with Redis cache

Jan Slusarczyk jan.slusarczyk at gmail.com
Wed Nov 27 18:42:42 CET 2013


I'm experimenting with Redis as a cache backend for typo3 4.7. 
Everything seemed to be working ok until I enabled cache_hash using the 
following:

$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_hash']['backend'] 
= 't3lib_cache_backend_RedisBackend';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_hash']['options'] 
= array(
	'hostname' => '192.168.0.3',
	'database' => 13,
);

Typo3 started to generate the following exception:

Oops, an error occurred!
The specified lifetime is of type "string" but a string or NULL is expected.

I've checked the source code of 
class.t3lib_cache_backend_redisbackend.php and lifetime is being checked 
for integer rather than a string:

[line 347] 		$lifetimeIsNull = is_null($lifetime);
[line 348] 		$lifetimeIsInteger = is_integer($lifetime);
[line 349]
[line 350] 		if (!$lifetimeIsNull && !$lifetimeIsInteger) {


So the value was failing the integer check. I've nailed the problem to a 
specific TyposScript object:

lib.forumNews = TEXT
lib.forumNews {
  	cache.key = bb7_forumnews
	cache.lifetime = 60
	cObject = COA
	cObject {	
	  10 = TEXT
	  10.value = <h5>...
	  20 = USER
  	  20.userFunc = user_feeds->user_linki
	  30 = TEXT
   	  30.value = <div class...
	}
}

cache.lifetime is indeed being passed to redis cache script as a string 
of value "60". I've tried intval($lifetime) and it started to work 
smoothly.

Is this a bug or something wrong with my configuration? How can I help 
with solving this one?

Regards
Jan Slusarczyk



More information about the TYPO3-dev mailing list