What's new in Valkey 9.0? Discover new features and improvements. Read the announcement.

ZSCORE

Returns the score of a member in a sorted set.

Usage
ZSCORE key member
Complexity
O(1)
Since
1.2.0
ACL Categories
@fast, @read, @sortedset
Command flags
READONLY, FAST

Returns the score of member in the sorted set at key.

If member does not exist in the sorted set, or key does not exist, nil is returned.

Examples

127.0.0.1:6379> ZADD myzset 1 "one"
(integer) 1
127.0.0.1:6379> ZSCORE myzset "one"
"1"

Replies

RESP2

One of the following:

  • Bulk string reply: the score of the member (a double-precision floating point number), represented as a string.
  • Nil reply: if member does not exist in the sorted set, or the key does not exist.

RESP3

One of the following:

  • Double reply: the score of the member (a double-precision floating point number).
  • Null reply: if member does not exist in the sorted set, or the key does not exist.