本文内容为 http://redis.io/commands/zscore 的翻译、注解、例子扩充及其它修改。感谢 Redis 作者 Antirez 为开源社区作出的贡献,本文保证最新、最准、最全以表示对其的敬意。欢迎留言纠错、提示更新或支持。
ZSCORE key member

返回存储在键 key 所对应的有序集合中成员 member 的分值(Score)

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

如果成员 member 不存在,或键 key 不存在,则返回 nil

If member does not exist in the sorted set, or key does not exist, nil is returned.
  • 成员 member 的分值(一个双精度浮点数(Double precision floating point number)),以字符串形式表示。

    The score of member (a double precision floating point number), represented as string.
  • redis> ZADD myzset 1 "one"
    (integer) 1
    redis> ZSCORE myzset "one"
    "1"
  • 版本支持

    1.2.0+

    时间复杂度(Time complexity)

    O(1)