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

Throw NotImplementedError for MEMORY DOCTOR and MEMORY HELP #1608

Merged
merged 6 commits into from
Oct 14, 2021
Merged
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
53 changes: 36 additions & 17 deletions redis/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def client_list(self, _type=None, client_id=[]):
return self.execute_command('CLIENT LIST', *args)

def client_getname(self):
"Returns the current connection name"
"""Returns the current connection name"""
return self.execute_command('CLIENT GETNAME')

def client_reply(self, reply):
Expand All @@ -396,11 +396,12 @@ def client_reply(self, reply):
return self.execute_command("CLIENT REPLY", reply)

def client_id(self):
"Returns the current connection id"
"""Returns the current connection id"""
return self.execute_command('CLIENT ID')

def client_trackinginfo(self):
"""Returns the information about the current client connection's
"""
Returns the information about the current client connection's
use of the server assisted client side cache.
See https://redis.io/commands/client-trackinginfo
"""
Expand Down Expand Up @@ -438,39 +439,45 @@ def client_unpause(self):
return self.execute_command('CLIENT UNPAUSE')

def readwrite(self):
"Disables read queries for a connection to a Redis Cluster slave node"
"""
Disables read queries for a connection to a Redis Cluster slave node.
"""
return self.execute_command('READWRITE')

def readonly(self):
"Enables read queries for a connection to a Redis Cluster replica node"
"""
Enables read queries for a connection to a Redis Cluster replica node.
"""
return self.execute_command('READONLY')

def config_get(self, pattern="*"):
"Return a dictionary of configuration based on the ``pattern``"
"""Return a dictionary of configuration based on the ``pattern``"""
return self.execute_command('CONFIG GET', pattern)

def config_set(self, name, value):
"Set config item ``name`` with ``value``"
return self.execute_command('CONFIG SET', name, value)

def config_resetstat(self):
"Reset runtime statistics"
"""Reset runtime statistics"""
return self.execute_command('CONFIG RESETSTAT')

def config_rewrite(self):
"Rewrite config file with the minimal change to reflect running config"
"""
Rewrite config file with the minimal change to reflect running config.
"""
return self.execute_command('CONFIG REWRITE')

def dbsize(self):
"Returns the number of keys in the current database"
"""Returns the number of keys in the current database"""
return self.execute_command('DBSIZE')

def debug_object(self, key):
"Returns version specific meta information about a given key"
"""Returns version specific meta information about a given key"""
return self.execute_command('DEBUG OBJECT', key)

def echo(self, value):
"Echo the string back from the server"
"""Echo the string back from the server"""
return self.execute_command('ECHO', value)

def flushall(self, asynchronous=False):
Expand Down Expand Up @@ -524,7 +531,8 @@ def lastsave(self):
return self.execute_command('LASTSAVE')

def lolwut(self, *version_numbers):
"""Get the Redis version and a piece of generative computer art
"""
Get the Redis version and a piece of generative computer art
See: https://redis.io/commands/lolwut
"""
if version_numbers:
Expand Down Expand Up @@ -568,11 +576,21 @@ def migrate(self, host, port, keys, destination_db, timeout,
timeout, *pieces)

def object(self, infotype, key):
"Return the encoding, idletime, or refcount about the key"
"""Return the encoding, idletime, or refcount about the key"""
return self.execute_command('OBJECT', infotype, key, infotype=infotype)

def memory_doctor(self):
raise NotImplementedError(
"MEMORY DOCTOR is intentionally not implemented in the client."
)

def memory_help(self):
raise NotImplementedError(
"MEMORY HELP is intentionally not implemented in the client."
)

def memory_stats(self):
"Return a dictionary of memory stats"
"""Return a dictionary of memory stats"""
return self.execute_command('MEMORY STATS')

def memory_usage(self, key, samples=None):
Expand All @@ -590,15 +608,16 @@ def memory_usage(self, key, samples=None):
return self.execute_command('MEMORY USAGE', key, *args)

def memory_purge(self):
"Attempts to purge dirty pages for reclamation by allocator"
"""Attempts to purge dirty pages for reclamation by allocator"""
return self.execute_command('MEMORY PURGE')

def ping(self):
"Ping the Redis server"
"""Ping the Redis server"""
return self.execute_command('PING')

def quit(self):
"""Ask the server to close the connection.
"""
Ask the server to close the connection.
https://redis.io/commands/quit
"""
return self.execute_command('QUIT')
Expand Down