summaryrefslogtreecommitdiff
path: root/redis/commands.py
diff options
context:
space:
mode:
authorJiekun <2014bduck@gmail.com>2021-08-29 16:32:18 +0800
committerGitHub <noreply@github.com>2021-08-29 11:32:18 +0300
commit5964d700beb9a6b195d64430b0a655e6aa6fd721 (patch)
treea5d2d085b4072fd1b12340c53419b21ffd4380cb /redis/commands.py
parent295b547fb0fe67cef7c21f84f98bbfad4ca80d08 (diff)
downloadredis-py-5964d700beb9a6b195d64430b0a655e6aa6fd721.tar.gz
#1434 Added support for ZMSCORE new in Redis 6.2 RC (#1437)
* #1434 Added zmscore command support * #1434 Fixed typo and doc * #1434 Set [] as default value for members arg in zmscore func * #1434 Set None as default value for members arg in zmscore func * #1434 Removed default value for members arg in zmscore func * Fixed flake8 formatting Co-authored-by: jiekun.zhu <jiekun.zhu@shopee.com>
Diffstat (limited to 'redis/commands.py')
-rw-r--r--redis/commands.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/redis/commands.py b/redis/commands.py
index 5aae14a..f940bcc 100644
--- a/redis/commands.py
+++ b/redis/commands.py
@@ -2461,6 +2461,20 @@ class Commands:
"""
return self._zaggregate('ZUNIONSTORE', dest, keys, aggregate)
+ def zmscore(self, key, members):
+ """
+ Returns the scores associated with the specified members
+ in the sorted set stored at key.
+ ``members`` should be a list of the member name.
+ Return type is a list of score.
+ If the member does not exist, a None will be returned
+ in corresponding position.
+ """
+ if not members:
+ raise DataError('ZMSCORE members must be a non-empty list')
+ pieces = [key] + members
+ return self.execute_command('ZMSCORE', *pieces)
+
def _zaggregate(self, command, dest, keys, aggregate=None,
**options):
pieces = [command]