ZMSCORE(3valkey)
π NAME π
zmscore β bestie, this is the Valkey Command Manual, section 3valkey, and this little icon returns the score of one or more members in a sorted set. That's it, that's the whole job. Slay. β¨
π SYNOPSIS π
ZMSCORE key member [member...]
πΈ DESCRIPTION πΈ
Okay so here's the tea: you hand zmscore a key and it goes and fetches the scores for all the members you asked about, from the sorted set living at that key. π
And listen β for every single member that does not exist in that sorted set? You get a nil value back. No drama, no error, just a lil nil. It's giving "you asked, I answered, the answer is nothing." π
π¦ REPLY π¦
RESP2
You get one of these two, depending on the vibe:
valkey-protocol(7)Nil reply: if the member does not exist in the sorted set.valkey-protocol(7)Array reply: a list ofvalkey-protocol(7)Bulk string reply member scores as double-precision floating point numbers. π
RESP3
And in RESP3-land, it's one of these:
valkey-protocol(7)Null reply: if the member does not exist in the sorted set.valkey-protocol(7)Array reply: a list ofvalkey-protocol(7)Double reply member scores as double-precision floating point numbers. π₯
β‘ COMPLEXITY β‘
O(N) β where N is the number of members being requested. So like, the more members you ask for, the more work it does. No cap. π«Ά
π ACL CATEGORIES π
@fast @read @sortedset
π HISTORY π
- Available since: 6.2.0 β
π EXAMPLES π
Watch her work, bestie:
127.0.0.1:6379> ZADD myzset 1 "one"
(integer) 1
127.0.0.1:6379> ZADD myzset 2 "two"
(integer) 1
127.0.0.1:6379> ZMSCORE myzset "one" "two" "nofield"
1) "1"
2) "2"
3) (nil)
See how "nofield" just gets a (nil)? Exactly. She said "not in my set, not my problem." π
π SEE ALSO π
Go read these too, they're all part of the sorted-set cinematic universe:
bzmpop(3valkey), bzpopmax(3valkey), bzpopmin(3valkey), zadd(3valkey), zcard(3valkey), zcount(3valkey), zdiff(3valkey), zdiffstore(3valkey), zincrby(3valkey), zinter(3valkey), zintercard(3valkey), zinterstore(3valkey), zlexcount(3valkey), zmpop(3valkey), zpopmax(3valkey), zpopmin(3valkey), zrandmember(3valkey), zrange(3valkey), zrangebylex(3valkey), zrangebyscore(3valkey), zrangestore(3valkey), zrank(3valkey), zrem(3valkey), zremrangebylex(3valkey), zremrangebyrank(3valkey), zremrangebyscore(3valkey), zrevrange(3valkey), zrevrangebylex(3valkey), zrevrangebyscore(3valkey), zrevrank(3valkey), zscan(3valkey), zscore(3valkey), zunion(3valkey), zunionstore(3valkey)
Okay that's the whole page, mwah. π This edition is 9.0.0, dated 2025-10-21, and it lives under the name ZMSCORE(3valkey) β go forth and score your sets, bestie. π§π
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms