Redis Research (ix)-ordered set type 2

Source: Internet
Author: User

The previous one has already told a part of the order of the ordered collection type.

http://blog.csdn.net/wtyvhreal/article/details/42804571


Third, command supplements

1. Get the number of elements in the collection

Zcard Key

2. Get the number of elements in the specified score range

<span style= "FONT-SIZE:14PX;" >zcount Key min max</span>

3. Delete one or more elements

<span style= "FONT-SIZE:14PX;" >zrem Key member</span>

The return value is the number of elements that were successfully deleted (does not contain elements that would not otherwise exist)

4. Delete Elements by rank range

Zremrangebyrank Key Start stop

Deletes all elements in the specified rank range from small to large order (0), and returns the number of deleted elements.

5. Deleting elements by fractional range

Zremrangebyscore Key min Max

The return value is the number of deleted elements

Delete the E with a score of 5, leaving D and F.

6. Get the ranking of the elements

Zrank Key Memberzrevrank Key member

Gets the rank of the specified element in the order of the element fraction from small to large (starting at 0).

7. Calculating the intersection of ordered sets

Used to calculate the intersection of multiple ordered sets and store the results in the destination key (also stored as an ordered collection type), the return value is the number of elements in the destination key.

The fraction of the elements in the destination key is determined by the aggregate parameter.

(1) when when aggregate is sum (the default), the fraction of the element in the destination key is the sum of the fraction of that element in each participating collection.

(2) When Aggregate is min, the fraction of the element in the destination key is the minimum value of each fraction of the set element that participates in the calculation

(3) When aggregate is Max, the element fraction in the destination key is the maximum value of the element fraction in each participating collection

The Zinterstore command sets the weight of each collection through the weights parameter, and the fraction of the element is multiplied by the weight of the collection each time the collection participates in the calculation.

2=1+10*0.1

4=2+20*0.1


There is also an imperative zunionstore, which is to compute a set of aggregates between sets.

Redis Research (ix)-ordered set type 2

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.