diff --git a/redis/client.py b/redis/client.py index a4d7f6b43a..f0eae479af 100755 --- a/redis/client.py +++ b/redis/client.py @@ -669,6 +669,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 TRACKINGINFO': lambda r: list(map(str_if_bytes, r)), 'CLUSTER ADDSLOTS': bool_ok, 'CLUSTER COUNT-FAILURE-REPORTS': lambda x: int(x), 'CLUSTER COUNTKEYSINSLOT': lambda x: int(x), diff --git a/redis/commands.py b/redis/commands.py index 42307799de..9748183cd0 100644 --- a/redis/commands.py +++ b/redis/commands.py @@ -356,6 +356,13 @@ def client_id(self): "Returns the current connection id" return self.execute_command('CLIENT ID') + def client_trackinginfo(self): + """Returns the information about the current client connection's + use of the server assisted client side cache. + See https://redis.io/commands/client-trackinginfo + """ + return self.execute_command('CLIENT TRACKINGINFO') + def client_setname(self, name): "Sets the current connection name" return self.execute_command('CLIENT SETNAME', name) diff --git a/tests/test_commands.py b/tests/test_commands.py index d77a01c29a..df24c66f33 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -307,6 +307,12 @@ def test_client_list_client_id(self, r): def test_client_id(self, r): assert r.client_id() > 0 + @skip_if_server_version_lt('6.2.0') + def test_client_trackinginfo(self, r): + res = r.client_trackinginfo() + assert len(res) > 2 + assert 'prefixes' in res + @skip_if_server_version_lt('5.0.0') def test_client_unblock(self, r): myid = r.client_id()