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 basic config_set / config_get support. #84

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

yossigo
Copy link
Contributor

@yossigo yossigo commented May 19, 2015

This is a very basic implementation and it lacks defaults, special handling of multi-line config keywods, etc.


def test_config_set(self):
eq_(self.redis.config_get('config-param'), {})
self.redis.config_set('config-param', 'value')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a test for ints?

"""
Set a configuration parameter.
"""
self.redis_config[name] = value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be returning "OK". For more info, http://redis.io/commands/config-set

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we get redis.exceptions.ResponseError: Unsupported CONFIG parameter: a for an invalid config. We probably need a list of configs to mimic the ResponseError. Not required for this PR though.

for name, value in self.redis_config.items():
if fnmatch.fnmatch(name, pattern):
try:
result[name] = int(value)
Copy link
Contributor

@srikalyan srikalyan Nov 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry was just looking at the documentation and ran a quick test observed that

`

r.config_get("max--entries*")
{'zset-max-ziplist-entries': '128', 'hash-max-ziplist-entries': '512', 'set-max-intset-entries': '512'}
`

So basically you don't need to convert them into int.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants