Skip to content

Commit bb9b825

Browse files
committed
add client no-evict
1 parent 15f315a commit bb9b825

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Diff for: redis/commands/core.py

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

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

Diff for: 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)