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

CONFIG GET - add the ability to pass multiple pattern parameters in one call #2142

Merged
merged 2 commits into from
Apr 27, 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
6 changes: 4 additions & 2 deletions redis/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,13 +760,15 @@ def command_docs(self, *args):
"COMMAND DOCS is intentionally not implemented in the client."
)

def config_get(self, pattern: PatternT = "*", **kwargs) -> ResponseT:
def config_get(
self, pattern: PatternT = "*", *args: List[PatternT], **kwargs
) -> ResponseT:
"""
Return a dictionary of configuration based on the ``pattern``

For more information see https://redis.io/commands/config-get
"""
return self.execute_command("CONFIG GET", pattern, **kwargs)
return self.execute_command("CONFIG GET", pattern, *args, **kwargs)

def config_set(self, name: KeyT, value: EncodableT, **kwargs) -> ResponseT:
"""Set config item ``name`` with ``value``
Expand Down
6 changes: 6 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,12 @@ def test_config_get(self, r):
# # assert 'maxmemory' in data
# assert data['maxmemory'].isdigit()

@skip_if_server_version_lt("7.0.0")
def test_config_get_multi_params(self, r: redis.Redis):
res = r.config_get("*max-*-entries*", "maxmemory")
assert "maxmemory" in res
assert "hash-max-listpack-entries" in res

@pytest.mark.onlynoncluster
@skip_if_redis_enterprise()
def test_config_resetstat(self, r):
Expand Down