From bb9b825af09e1e7053d95003918d88b727d17080 Mon Sep 17 00:00:00 2001 From: dvora-h Date: Tue, 4 Jan 2022 14:36:58 +0200 Subject: [PATCH] add client no-evict --- redis/commands/core.py | 8 ++++++++ tests/test_commands.py | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/redis/commands/core.py b/redis/commands/core.py index 4f0accd957..4d4d9cf89d 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -639,6 +639,14 @@ def client_unpause(self, **kwargs): """ return self.execute_command("CLIENT UNPAUSE", **kwargs) + def client_no_evict(self, mode: str) -> str: + """ + Sets the client eviction mode for the current connection. + + For more information check https://redis.io/commands/client-no-evict + """ + return self.execute_command("CLIENT NO-EVICT", mode) + def command(self, **kwargs): """ Returns dict reply of details about all Redis commands. diff --git a/tests/test_commands.py b/tests/test_commands.py index b28b63ea6e..7e1e91ac87 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -592,6 +592,13 @@ def test_client_pause_all(self, r, r2): def test_client_unpause(self, r): assert r.client_unpause() == b"OK" + @pytest.mark.onlynoncluster + # @skip_if_server_version_lt("7.0.0") turn on after redis 7 release + def test_client_no_evict(self, unstable_r): + assert unstable_r.client_no_evict("ON") == b"OK" + with pytest.raises(TypeError): + unstable_r.client_no_evict() + @pytest.mark.onlynoncluster @skip_if_server_version_lt("3.2.0") def test_client_reply(self, r, r_timeout):