w3resource

Redis Sorted Sets: ZSCORE

Redis ZSCORE Command

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



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/redis/redis-zscore-key-member.php