当前位置:网站首页>[redis] sortedset type
[redis] sortedset type
2022-06-29 01:58:00 【Riding a snail chasing a missile '】
List of articles
One 、SortedSet type
Redis Of SortedSet It's a sortable set aggregate , And Java Medium TreeSet Some similar , But the underlying data structure is very different .SortedSet Each element in the has a score attribute , Can be based on score Attribute to sort elements , The underlying implementation is a jump table (SkipList) Add hash surface .SortedSet It has the following characteristics :
- Sortable
- Elements do not repeat
- Fast query speed
because SortedSet Sortable properties of , Often used to implement functions like leaderboards .

1.1 ZADD & ZREM & ZCRAD

- ZADD key score member: Add one or more elements to sorted set, If it already exists, update its score value
- ZREM key member: Delete sorted set A specified element in
- ZCARD key: obtain sorted set The number of elements in
1.2 ZSCORE & ZRANK

ZSCORE key member: obtain sorted set Of the specified element in score value
ZRANK key member: obtain sorted set The ranking of the specified elements in
1.3 ZCOUNT & ZRANGE & ZRANGEBYSCORE

ZCOUNT key min max: Statistics score The number of all elements whose values are within a given range
ZRANGE key min max: according to score After ordering , Get the elements within the specified ranking range
ZRANGEBYSCORE key min max: according to score After ordering , Get specified score Elements in scope
1.4 ZDIFF & ZINTER & ZUNION
- ZDIFF、ZINTER、ZUNION: Difference set 、 intersection 、 Combine
1.5 Case study
Save the scores of the following students in the class into Redis Of SortedSet in : Jack 85,Lucy 89,Tom 82, Tom 95,Jerry 78,Amy 92,Miles 76· And realize the following functions :

- Delete Tom classmate

obtain Amy Students' scores

obtain Jerry The ranking of students


Inquire about 80 There are several students below

to Amy Classmate plus 2 branch

- Before finding out the results 3 My classmate

- Find out the results 80 All the students below

边栏推荐
- [MySQL practice of high concurrency, high performance and high availability of massive data -9] - transaction concurrency control solutions lbcc and mvcc
- C language course design - food warehouse management system
- Analysis of advantages and disadvantages of environment encryption and transparent encryption
- How to encrypt anti copy program
- Magic Quadrant of motianlun's 2021 China Database
- How to become a senior digital IC Design Engineer (6-5) digital IC Verification: coverage collection
- 想请教一下,我在中山,到哪里开户比较好?在线开户是安全么?
- How does flush open an account? Is it safe to open an account online?
- 指南针手机股票开户哪个券商更安全更方便?
- 栈的增删查改---动态内存
猜你喜欢

Finally got the byte offer. The 25-year-old inexperienced experience in software testing is written to you who are still confused

SAP ui5 beginner tutorial Part 23 - sorting sort and grouping Group trial version of list control

独家分析 | 软件测试关于简历和面试的真实情况

Application of X6 in data stack index management
Scala 基础 (三):运算符和流程控制
![[机缘参悟-33]:眼见不一定为实,大多数时候“眼见为虚”](/img/60/703a5bc3038d28bcf812415032f240.jpg)
[机缘参悟-33]:眼见不一定为实,大多数时候“眼见为虚”

基于 RISC-V SoC 的可配置 FFT 系统设计(1)引言

PR FAQ: how to retrieve accidentally deleted video and audio in PR?

Typescript (7) generic
![[high concurrency, high performance and high availability of massive data MySQL practice-10] - Implementation of mvcc in InnoDB](/img/dc/a30ccd9943e668aef8c874980a4975.jpg)
[high concurrency, high performance and high availability of massive data MySQL practice-10] - Implementation of mvcc in InnoDB
随机推荐
请问etf基金是否靠谱,安全吗
基于 FPGA 的 RISC CPU 设计(4)关于项目的 36 个问题及其答案
【Redis】Set类型
Scala 基礎 (三):運算符和流程控制
Fibonacci sequence
同花顺究竟是如何开户?现在网上开户安全么?
Teach you how to understand the test environment project deployment
Would like to ask how to choose a securities firm? Is it safe to open an account online now?
Why is it recommended that you choose the self research company as much as possible
okcc呼叫中心的计费方式哪个最好
How to become a senior digital IC Design Engineer (4-5) script: file comparison operation implemented by shell script
大三下期末考试
Why install an SSL certificate on a web site?
Last week, institutional encryption asset products outflow US $423million, a record high
芯片原厂必学技术(1)引言
P7 Erkai early know - registration and application creation
牛客网——华为题库(41~50)
PHP hospital network reservation management system source code, hospital consultation reservation registration OA system (commercial or graduation design)
同花顺究竟是如何开户?在线开户是安全么?
ASP. Net based on LAN