Skip to content

Support for CLIENT TRACKINFO #1560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions redis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
7 changes: 7 additions & 0 deletions redis/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down