ZSCORE key member
Return the score of the specified element of the sorted set at the key.
Note: If the specified element does not exist in the sorted set, or the key does not exist at all, a special 'nil' value is returned.
TIME COMPLEXITY: O(1)
RETURN VALUE: Bulk reply, the score of member (a double precision floating point number), represented as a string.
Syntax:
ZSCORE key member
Example 1: When the key and member are present.
redis:6379> ZADD mykey 1 A 2 B 3 C 4 D 5 E(integer) 5redis:6379> ZSCORE mykey A"1"
Output
1
Example 2: When the key or member is not present.
redis:6379> ZADD mykey 1 A 2 B 3 C 4 D 5 E(integer) 5redis:6379> ZSCORE mykey AA(nil)redis:6379> ZSCORE redisKey A(nil)
Output
nil
No comments:
Post a Comment