diff options
author | Chayim <chayim@users.noreply.github.com> | 2021-10-18 12:08:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-18 12:08:54 +0300 |
commit | 576d33c148de867fd48077a55d51135d14e45ec0 (patch) | |
tree | 022318ebcc92b8e20988758194b02c1bad574396 /redis | |
parent | 726eedeae75e51c18bdb2ba697ff390a1efb2b78 (diff) | |
download | redis-py-576d33c148de867fd48077a55d51135d14e45ec0.tar.gz |
REPLICAOF command implementation (#1622)
Diffstat (limited to 'redis')
-rw-r--r-- | redis/commands.py | 10 | ||||
-rw-r--r-- | redis/features.py | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/redis/commands.py b/redis/commands.py index 69aae20..c2d9ff7 100644 --- a/redis/commands.py +++ b/redis/commands.py @@ -2845,6 +2845,16 @@ class Commands: def cluster(self, cluster_arg, *args): return self.execute_command('CLUSTER %s' % cluster_arg.upper(), *args) + def replicaof(self, *args): + """ + Update the replication settings of a redis replica, on the fly. + Examples of valid arguments include: + NO ONE (set no replication) + host port (set to the host and port of a redis server) + see: https://redis.io/commands/replicaof + """ + return self.execute_command('REPLICAOF', *args) + def eval(self, script, numkeys, *keys_and_args): """ Execute the Lua ``script``, specifying the ``numkeys`` the script diff --git a/redis/features.py b/redis/features.py new file mode 100644 index 0000000..a96bac7 --- /dev/null +++ b/redis/features.py @@ -0,0 +1,5 @@ +try: + import hiredis # noqa + HIREDIS_AVAILABLE = True +except ImportError: + HIREDIS_AVAILABLE = False |