diff options
-rwxr-xr-x | redis/client.py | 2 | ||||
-rw-r--r-- | redis/commands.py | 3 | ||||
-rw-r--r-- | tests/test_commands.py | 6 |
3 files changed, 11 insertions, 0 deletions
diff --git a/redis/client.py b/redis/client.py index 4a9e33a..ef37506 100755 --- a/redis/client.py +++ b/redis/client.py @@ -685,6 +685,8 @@ class Redis(Commands, object): 'CLUSTER SET-CONFIG-EPOCH': bool_ok, 'CLUSTER SETSLOT': bool_ok, 'CLUSTER SLAVES': parse_cluster_nodes, + 'COMMAND': int, + 'COMMAND COUNT': int, 'CONFIG GET': parse_config_get, 'CONFIG RESETSTAT': bool_ok, 'CONFIG SET': bool_ok, diff --git a/redis/commands.py b/redis/commands.py index 2d39f5d..7066bd8 100644 --- a/redis/commands.py +++ b/redis/commands.py @@ -2924,6 +2924,9 @@ class Commands: """ return self.execute_command('MODULE LIST') + def command_count(self): + return self.execute_command('COMMAND COUNT') + class Script: "An executable Lua script object returned by ``register_script``" diff --git a/tests/test_commands.py b/tests/test_commands.py index 2c0137f..5a5e8f3 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -3240,6 +3240,12 @@ class TestRedisCommands: assert isinstance(r.module_list(), list) assert not r.module_list() + @skip_if_server_version_lt('2.8.13') + def test_command_count(self, r): + res = r.command_count() + assert isinstance(res, int) + assert res >= 100 + class TestBinarySave: |