Redis zrevrank Command

Source: Internet
Author: User
Tags redis
Redis zrevrank Command

Redis ordered set (sorted set)

The Redis zrevrank command returns the rank of the member in the ordered set. Where ordered set members are sorted by fractional values descending (from large to small).

The ranking is based on 0, that is, the member with the highest number of points is ranked at 0.

Use the Zrank command to get the ranking of members in ascending (small to large) increments of fractional values. Grammar

The basic syntax for the Redis zrevrank command is as follows:

Redis 127.0.0.1:6379> Zrevrank Key Member
Available versions

>= 2.2.0 return value

Returns the rank of a member if the member is a member of an ordered set key. Returns nil if the member is not a member of the ordered set key. Example

Redis 127.0.0.1:6379> zrange Salary 0-1 withscores     # test Data
1) "Jack"
2) "3" "
Peter"
4) "3500 "
5" "Tom"
6) "127.0.0.1:6379>"

Redis Zrevrank salary Peter     # Peter's payroll Second
(integer) 1

Redis 127.0.0.1:6379> Zrevrank salary Tom       # Tom's highest salary
(integer) 0

Redis ordered set (sorted set)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.