Skip to content

Commit

Permalink
Added expireat(key, timestamp)` method (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
sevrugin authored Jan 24, 2022
1 parent 8884530 commit 958abce
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/M6Web/Component/RedisMock/RedisMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,17 @@ public function ttl($key)
}

public function expire($key, $seconds)
{
return $this->expireat($key, time() + $seconds);
}

public function expireat($key, $timestamp)
{
if (!array_key_exists($key, self::$dataValues[$this->storage]) || $this->deleteOnTtlExpired($key)) {
return $this->returnPipedInfo(0);
}

self::$dataTtl[$this->storage][$key] = time() + $seconds;
self::$dataTtl[$this->storage][$key] = $timestamp;

return $this->returnPipedInfo(1);
}
Expand Down

0 comments on commit 958abce

Please sign in to comment.