w3resource

Redis Sorted Sets: ZSCORE

ZSCORE key member

Redis ZSCORE command is used to return the score of a member in the sorted set at the key. If a member does not exist in the sorted set, or key does not exist, nil is returned.

Syntax:

ZSCORE key member

Available since

1.2.0.

Return Value

Bulk string reply, the score of the member (a double precision floating point number), represented as a string.

Return Value Type

String

Example: Redis ZSCORE

127.0.0.1:6379> ZADD mycityset 80 Delhi 60 Mumbai 70 Hyderabad 50 Kolkata 65 Chennai
(integer) 5
127.0.0.1:6379> ZRANGE mycityset 0 -1 WITHSCORES
 1) "Kolkata"
 2) "50"
 3) "Mumbai"
 4) "60"
 5) "Chennai"
 6) "65"
 7) "Hyderabad"
 8) "70"
 9) "Delhi"
10) "80"
127.0.0.1:6379> ZSCORE mycityset Kolkata
"50"
127.0.0.1:6379> ZSCORE mycityset Chennai
"65"

Previous: ZREVRANK
Next: ZUNIONSTORE



Follow us on Facebook and Twitter for latest update.