Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for CLIENT NO-EVICT #1856

Merged
merged 1 commit into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions redis/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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