summaryrefslogtreecommitdiff
path: root/redis/client.py
diff options
context:
space:
mode:
authorSimon Charette <charettes@users.noreply.github.com>2020-11-22 15:52:44 -0500
committerGitHub <noreply@github.com>2020-11-22 12:52:44 -0800
commit1a41cfd95a53a95b078084d8627be6b6fba3bb71 (patch)
tree0a3d504b1f61192b17075a733429a9533e6b404f /redis/client.py
parent8c176cdc7f36e2cbcd3254768766035a7b7cd8b3 (diff)
downloadredis-py-1a41cfd95a53a95b078084d8627be6b6fba3bb71.tar.gz
Add support for the ABSTTL option of the RESTORE command. (#1423)
Add support for the ABSTTL option of the RESTORE command.
Diffstat (limited to 'redis/client.py')
-rwxr-xr-xredis/client.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/redis/client.py b/redis/client.py
index 08b0314..18553b9 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -1811,14 +1811,23 @@ class Redis:
"Rename key ``src`` to ``dst`` if ``dst`` doesn't already exist"
return self.execute_command('RENAMENX', src, dst)
- def restore(self, name, ttl, value, replace=False):
+ def restore(self, name, ttl, value, replace=False, absttl=False):
"""
Create a key using the provided serialized value, previously obtained
using DUMP.
+
+ ``replace`` allows an existing key on ``name`` to be overridden. If
+ it's not specified an error is raised on collision.
+
+ ``absttl`` if True, specified ``ttl`` should represent an absolute Unix
+ timestamp in milliseconds in which the key will expire. (Redis 5.0 or
+ greater).
"""
params = [name, ttl, value]
if replace:
params.append('REPLACE')
+ if absttl:
+ params.append('ABSTTL')
return self.execute_command('RESTORE', *params)
def set(self, name, value,