From 958abce71d8f2bf6a5ce9ccfde0168408ee105cb Mon Sep 17 00:00:00 2001 From: Sergey Date: Mon, 24 Jan 2022 11:32:59 +0200 Subject: [PATCH] Added `expireat(key, timestamp)`` method (#97) --- src/M6Web/Component/RedisMock/RedisMock.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/M6Web/Component/RedisMock/RedisMock.php b/src/M6Web/Component/RedisMock/RedisMock.php index 92948ba..186f35d 100644 --- a/src/M6Web/Component/RedisMock/RedisMock.php +++ b/src/M6Web/Component/RedisMock/RedisMock.php @@ -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); }