Merge pull request #132 from Alphix/redis_setex_fix

[redis] Fix call to setex()
This commit is contained in:
the-djmaze 2021-08-27 10:01:32 +02:00 committed by GitHub
commit 74a1b72703
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,7 +70,14 @@ class Redis implements \MailSo\Cache\DriverInterface
public function Set(string $sKey, string $sValue) : bool
{
return $this->oRedis ? $this->oRedis->setex($this->generateCachedKey($sKey), $this->iExpire, $sValue) : false;
if (!$this->oRedis)
{
return false;
}
$sValue = $this->oRedis->setex($this->generateCachedKey($sKey), $this->iExpire, $sValue);
return $sValue === true || $sValue == 'OK';
}
public function Get(string $sKey) : string