From f987a0cc86bd37aeaec3d73547c6176b651acd7b Mon Sep 17 00:00:00 2001 From: dvora-h <67596500+dvora-h@users.noreply.github.com> Date: Mon, 7 Mar 2022 01:33:42 +0200 Subject: Add support for EXPIRETIME (#1860) * add expiretime * skip test --- redis/commands/core.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'redis/commands/core.py') diff --git a/redis/commands/core.py b/redis/commands/core.py index e9bb286..cdbb267 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -1523,6 +1523,15 @@ class BasicKeyCommands(CommandsProtocol): when = int(time.mktime(when.timetuple())) return self.execute_command("EXPIREAT", name, when) + def expiretime(self, key: str) -> int: + """ + Returns the absolute Unix timestamp (since January 1, 1970) in seconds + at which the given key will expire. + + For more information check https://redis.io/commands/expiretime + """ + return self.execute_command("EXPIRETIME", key) + def get(self, name: KeyT) -> ResponseT: """ Return the value at key ``name``, or None if the key doesn't exist -- cgit v1.2.1