Skip to content

Commit 146e58e

Browse files
authored
add client no-evict (#1856)
1 parent c3c0b0b commit 146e58e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

redis/commands/core.py

+8
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,14 @@ def client_unpause(self, **kwargs):
640640
"""
641641
return self.execute_command("CLIENT UNPAUSE", **kwargs)
642642

643+
def client_no_evict(self, mode: str) -> str:
644+
"""
645+
Sets the client eviction mode for the current connection.
646+
647+
For more information check https://redis.io/commands/client-no-evict
648+
"""
649+
return self.execute_command("CLIENT NO-EVICT", mode)
650+
643651
def command(self, **kwargs):
644652
"""
645653
Returns dict reply of details about all Redis commands.

tests/test_commands.py

+7
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,13 @@ def test_client_pause_all(self, r, r2):
592592
def test_client_unpause(self, r):
593593
assert r.client_unpause() == b"OK"
594594

595+
@pytest.mark.onlynoncluster
596+
# @skip_if_server_version_lt("7.0.0") turn on after redis 7 release
597+
def test_client_no_evict(self, unstable_r):
598+
assert unstable_r.client_no_evict("ON") == b"OK"
599+
with pytest.raises(TypeError):
600+
unstable_r.client_no_evict()
601+
595602
@pytest.mark.onlynoncluster
596603
@skip_if_server_version_lt("3.2.0")
597604
def test_client_reply(self, r, r_timeout):

0 commit comments

Comments
 (0)