summaryrefslogtreecommitdiff
path: root/redis/commands
diff options
context:
space:
mode:
authorAvital Fine <79420960+AvitalFineRedis@users.noreply.github.com>2021-12-02 18:53:00 +0100
committerGitHub <noreply@github.com>2021-12-02 19:53:00 +0200
commitc2d4621d5da2f4506fb484eb787f004a235c76b1 (patch)
treebcc2e7f329996bc2ee97e1e5c18ed47dad028e54 /redis/commands
parent48b19dfc526102864c7289cf1f3c4889c858d359 (diff)
downloadredis-py-c2d4621d5da2f4506fb484eb787f004a235c76b1.tar.gz
Adding ROLE Command (#1610)
Co-authored-by: Chayim <chayim@users.noreply.github.com>
Diffstat (limited to 'redis/commands')
-rw-r--r--redis/commands/core.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/redis/commands/core.py b/redis/commands/core.py
index 462fba7..fec3095 100644
--- a/redis/commands/core.py
+++ b/redis/commands/core.py
@@ -333,6 +333,16 @@ class ManagementCommands:
pieces.append("SCHEDULE")
return self.execute_command("BGSAVE", *pieces, **kwargs)
+ def role(self):
+ """
+ Provide information on the role of a Redis instance in
+ the context of replication, by returning if the instance
+ is currently a master, slave, or sentinel.
+
+ For more information check https://redis.io/commands/role
+ """
+ return self.execute_command("ROLE")
+
def client_kill(self, address, **kwargs):
"""Disconnects the client at ``address`` (ip:port)
@@ -864,11 +874,15 @@ class ManagementCommands:
For more information check https://redis.io/commands/slowlog-get
"""
+ from redis.client import NEVER_DECODE
+
args = ["SLOWLOG GET"]
if num is not None:
args.append(num)
decode_responses = self.get_connection_kwargs().get("decode_responses", False)
- return self.execute_command(*args, decode_responses=decode_responses, **kwargs)
+ if decode_responses is True:
+ kwargs[NEVER_DECODE] = []
+ return self.execute_command(*args, **kwargs)
def slowlog_len(self, **kwargs):
"""