Skip to content

Commit 0ea3e4b

Browse files
Merge pull request #133 from adioe3/master
Fix lifetimes passed as string "false" from layout XML
2 parents 60667b9 + bc63e72 commit 0ea3e4b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Cm/Cache/Backend/Redis.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,25 @@ public function test($id)
493493
return ($mtime ? $mtime : FALSE);
494494
}
495495

496+
/**
497+
* Get the life time
498+
*
499+
* if $specificLifetime is not false, the given specific life time is used
500+
* else, the global lifetime is used
501+
*
502+
* @param int $specificLifetime
503+
* @return int Cache life time
504+
*/
505+
public function getLifetime($specificLifetime)
506+
{
507+
// Lifetimes set via Layout XMLs get parsed as string so bool(false) becomes string("false")
508+
if ($specificLifetime === 'false') {
509+
$specificLifetime = false;
510+
}
511+
512+
return parent::getLifetime($specificLifetime);
513+
}
514+
496515
/**
497516
* Save some string datas into a cache record
498517
*

0 commit comments

Comments
 (0)