diff --git a/redis/client.py b/redis/client.py index ae4fae2ace..81cec5716e 100755 --- a/redis/client.py +++ b/redis/client.py @@ -768,6 +768,7 @@ class Redis(RedisModuleCommands, CoreCommands, SentinelCommands): "STRALGO": parse_stralgo, "PUBSUB NUMSUB": parse_pubsub_numsub, "RANDOMKEY": lambda r: r and r or None, + "RESET": str_if_bytes, "SCAN": parse_scan, "SCRIPT EXISTS": lambda r: list(map(bool, r)), "SCRIPT FLUSH": bool_ok, diff --git a/redis/commands/core.py b/redis/commands/core.py index 835ea6125a..154df63e73 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -707,6 +707,13 @@ def lolwut(self, *version_numbers, **kwargs): else: return self.execute_command("LOLWUT", **kwargs) + def reset(self): + """Perform a full reset on the connection's server side contenxt. + + See: https://redis.io/commands/reset + """ + return self.execute_command("RESET") + def migrate( self, host, diff --git a/tests/test_commands.py b/tests/test_commands.py index b8dc69f9eb..c15eee2c3f 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -640,6 +640,11 @@ def test_lolwut(self, r): lolwut = r.lolwut(5, 6, 7, 8).decode("utf-8") assert "Redis ver." in lolwut + @pytest.mark.onlynoncluster + @skip_if_server_version_lt("6.2.0") + def test_reset(self, r): + assert r.reset() == "RESET" + def test_object(self, r): r["a"] = "foo" assert isinstance(r.object("refcount", "a"), int)