Upstash Documentation

ZSCORE

Get member's score.
2 min read

Use ZSCORE to get the score of a member of a sorted set.

The reply is null when the member or the key does not exist, so it doubles as a membership test that also tells you the value. Use ZMSCORE to read several scores in one call, and ZRANK when you want the member's position rather than its score.

Syntax#

Arguments#

ArgumentRequiredRepeatableDescription
<key>YesNoRedis key targeted by the command.
<member>YesNoMember name.

Important points#

  • RESP2 represents floating-point reply values as bulk strings; RESP3 may use native double replies. Client libraries commonly decode either form to a language number.

Response#

The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.

ProtocolReply
RESP2Bulk string containing a number or Null bulk string or null array
RESP3Double or Null
Note

Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.

Examples#

TCP examples use the TLS REDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.

Redis CLI
@upstash/redis
upstash_redis
ioredis
node-redis
redis-py
go-redis
jedis
redis-rs