colinmollenhour / Cm_Cache_Backend_Redis

A Zend_Cache backend for Redis with full support for tags (works great with Magento)
Other
390 stars 142 forks source link

Avoid expiration life time when $specificLifetime has not passed in f… #148

Closed vjuradouson closed 4 years ago

vjuradouson commented 4 years ago

Avoid expiration life time when $specificLifetime has not passed in function, the casting "(int)" to "null" value is equals to "0":

Summary:

    //If the function returns a null, the casting transforms null to 0
    $lifetime = (int)$this->_getAutoExpiringLifetime($this->getLifetime($specificLifetime), $id);

    //If $lifetime is 0 the requirement is met and the key expires...
    if ($lifetime !== false && !is_null($lifetime)) {
      $this->_redis->expire(self::PREFIX_KEY.$id, min($lifetime, self::MAX_LIFETIME));
    }