Skip to content

Commit

Permalink
add client no-evict (#1856)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvora-h committed Feb 2, 2022
1 parent c3c0b0b commit 146e58e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions redis/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,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.
Expand Down
7 changes: 7 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 146e58e

Please sign in to comment.