summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xredis/client.py1
-rw-r--r--redis/commands.py8
-rw-r--r--tests/test_commands.py5
3 files changed, 14 insertions, 0 deletions
diff --git a/redis/client.py b/redis/client.py
index 2e2a26a..fde153d 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -675,6 +675,7 @@ class Redis(Commands, object):
'CLIENT SETNAME': bool_ok,
'CLIENT UNBLOCK': lambda r: r and int(r) == 1 or False,
'CLIENT PAUSE': bool_ok,
+ 'CLIENT GETREDIR': int,
'CLIENT TRACKINGINFO': lambda r: list(map(str_if_bytes, r)),
'CLUSTER ADDSLOTS': bool_ok,
'CLUSTER COUNT-FAILURE-REPORTS': lambda x: int(x),
diff --git a/redis/commands.py b/redis/commands.py
index c2d9ff7..cd3b802 100644
--- a/redis/commands.py
+++ b/redis/commands.py
@@ -377,6 +377,14 @@ class Commands:
"""Returns the current connection name"""
return self.execute_command('CLIENT GETNAME')
+ def client_getredir(self):
+ """Returns the ID (an integer) of the client to whom we are
+ redirecting tracking notifications.
+
+ see: https://redis.io/commands/client-getredir
+ """
+ return self.execute_command('CLIENT GETREDIR')
+
def client_reply(self, reply):
"""Enable and disable redis server replies.
``reply`` Must be ON OFF or SKIP,
diff --git a/tests/test_commands.py b/tests/test_commands.py
index 2136d37..62d42db 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -490,6 +490,11 @@ class TestRedisCommands:
# validate it was set
assert r.get('foo') == b'bar'
+ @skip_if_server_version_lt('6.0.0')
+ def test_client_getredir(self, r):
+ assert isinstance(r.client_getredir(), int)
+ assert r.client_getredir() == -1
+
def test_config_get(self, r):
data = r.config_get()
assert 'maxmemory' in data