Skip to content

Commit 8991370

Browse files
COMMAND GETKEYS support (#1738)
1 parent e5786c2 commit 8991370

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

redis/commands/core.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3989,6 +3989,9 @@ def command_info(self):
39893989
def command_count(self):
39903990
return self.execute_command('COMMAND COUNT')
39913991

3992+
def command_getkeys(self, *args):
3993+
return self.execute_command('COMMAND GETKEYS', *args)
3994+
39923995
def command(self):
39933996
return self.execute_command('COMMAND')
39943997

tests/test_commands.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3796,6 +3796,15 @@ def test_command_count(self, r):
37963796
assert isinstance(res, int)
37973797
assert res >= 100
37983798

3799+
@skip_if_server_version_lt('2.8.13')
3800+
def test_command_getkeys(self, r):
3801+
res = r.command_getkeys('MSET', 'a', 'b', 'c', 'd', 'e', 'f')
3802+
assert res == [b'a', b'c', b'e']
3803+
res = r.command_getkeys('EVAL', '"not consulted"',
3804+
'3', 'key1', 'key2', 'key3',
3805+
'arg1', 'arg2', 'arg3', 'argN')
3806+
assert res == [b'key1', b'key2', b'key3']
3807+
37993808
@skip_if_server_version_lt('2.8.13')
38003809
def test_command(self, r):
38013810
res = r.command()

0 commit comments

Comments
 (0)