summaryrefslogtreecommitdiff
path: root/redis/cluster.py
diff options
context:
space:
mode:
Diffstat (limited to 'redis/cluster.py')
-rw-r--r--redis/cluster.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/redis/cluster.py b/redis/cluster.py
index 4b327ad..8c2dfc2 100644
--- a/redis/cluster.py
+++ b/redis/cluster.py
@@ -292,6 +292,11 @@ class RedisCluster(RedisClusterCommands):
[
"FLUSHALL",
"FLUSHDB",
+ "FUNCTION DELETE",
+ "FUNCTION FLUSH",
+ "FUNCTION LIST",
+ "FUNCTION LOAD",
+ "FUNCTION RESTORE",
"SCRIPT EXISTS",
"SCRIPT FLUSH",
"SCRIPT LOAD",
@@ -299,6 +304,10 @@ class RedisCluster(RedisClusterCommands):
PRIMARIES,
),
list_keys_to_dict(
+ ["FUNCTION DUMP"],
+ RANDOM,
+ ),
+ list_keys_to_dict(
[
"CLUSTER COUNTKEYSINSLOT",
"CLUSTER DELSLOTS",
@@ -916,6 +925,10 @@ class RedisCluster(RedisClusterCommands):
else:
keys = self._get_command_keys(*args)
if keys is None or len(keys) == 0:
+ # FCALL can call a function with 0 keys, that means the function
+ # can be run on any node so we can just return a random slot
+ if command in ("FCALL", "FCALL_RO"):
+ return random.randrange(0, REDIS_CLUSTER_HASH_SLOTS)
raise RedisClusterException(
"No way to dispatch this command to Redis Cluster. "
"Missing key.\nYou can execute the command by specifying "