Easy Tutorial
❮ Keys Move Lists Llen ❯

Redis Zscore Command

Redis Sorted Set

The Redis Zscore command returns the score value of a member in the sorted set.

If the member element is not a member of the sorted set key, or if the key does not exist, it returns nil.

Syntax

The basic syntax of the redis Zscore command is as follows:

redis 127.0.0.1:6379> ZSCORE key member

Available Versions

= 1.2.0

Return Value

The score value of the member, represented as a string.

Example

redis 127.0.0.1:6379> ZRANGE salary 0 -1 WITHSCORES    # Test data
1) "tom"
2) "2000"
3) "peter"
4) "3500"
5) "jack"
6) "5000"

redis 127.0.0.1:6379> ZSCORE salary peter              # Note the return value is a string
"3500"

Redis Sorted Set

❮ Keys Move Lists Llen ❯