Skip to content

Commit 559434b

Browse files
Merge pull request #142 from bjornsnoen/hotfix/make-redis-behave-like-builtin-fpc
[FIX] Make redis cache backend work like builtin cache
2 parents 48a265f + 7d082ad commit 559434b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Cm/Cache/Backend/Redis.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,14 +616,14 @@ public function save($data, $id, $tags = array(), $specificLifetime = false)
616616
self::FIELD_DATA => $this->_encodeData($data, $this->_compressData),
617617
self::FIELD_TAGS => $this->_encodeData(implode(',',$tags), $this->_compressTags),
618618
self::FIELD_MTIME => time(),
619-
self::FIELD_INF => $lifetime ? 0 : 1,
619+
self::FIELD_INF => is_null($lifetime) ? 1 : 0,
620620
));
621621
if( ! $result) {
622622
throw new CredisException("Could not set cache key $id");
623623
}
624624

625625
// Set expiration if specified
626-
if ($lifetime) {
626+
if ($lifetime !== false && !is_null($lifetime)) {
627627
$this->_redis->expire(self::PREFIX_KEY.$id, min($lifetime, self::MAX_LIFETIME));
628628
}
629629

0 commit comments

Comments
 (0)