当前位置:网站首页>Redis order sorting command
Redis order sorting command
2022-06-26 16:07:00 【Hua Weiyun】
Redis Sequential sort command
redis> LPUSH today_cost 30 1.5 10 8(integer) 4# Sort redis> SORT today_cost1) "1.5"2) "8"3) "10"4) "30"
The sorting key indication theory is to set up a linked list with a width similar to that of the ring , Each item of the linked list is a reassignment target construct , Depending on the module indicated by the taxonomy, the structure of the reassignment target is also different
The manager is
typedef struct _redisSortObject { robj *obj; union { double score; robj *cmpobj; } u;} redisSortObject;
obj Point to the exact element values in the following table , The fractional value is the floating point of the value of the list item , Then according to the value of the integral, expand the order of the character size of the linked list , Then return the conclusion after the sequence to the customer
Other option module expansion order
The taxonomy instructs the manager to expand in character order , When the key sorting of string value is required , Insert alpha option
asc The options are in ascending order ,desc The options are in descending order ,limit Option is to restrict the sorted results ,by The option is to sort by the weight of the elements contained in the keys of some strings or hash keys ,get Option is to get the corresponding key value according to the sorting result ,store The option is to save the sorting results to the specified key
Indicates the order of the modules
The execution order of these options is sorted first , And then there was limit Options , Limit the length of sorting results , And then there was get Option to get external keys , And then there was store Option to save the result set .
In addition to receiving instructions , The sequence of other indicating modules has no impact on the result set
Okay , Today's content mainly explains redis Of sort Sort instruction and its parameters , such as asc Options are in ascending order ,desc Descending ,limit Limit the sorted results ,by Options are sorted by the key weight of the string ,get Option to extract the corresponding key value from the result output ,store The option is to save the sorting results to the specified key ,sort key The principle of command is to create a and key An array with the same list length , Each item of the array is redisSortObject structure , according to sort The options of the command are different redisSortObject It's also different in structure .
️ Thank you for your
If you think this is helpful for you :
- Welcome to follow me ️, give the thumbs-up , Comment on , forward
- Focus on
Panpan small class
, Push good articles for you regularly , There are also group chat and irregular lottery activities , You can say what you want , Communicate with the great gods , Learning together . - If there is anything inappropriate, you are welcome to criticize and correct .
边栏推荐
- Solana扩容机制分析(1):牺牲可用性换取高效率的极端尝试 | CatcherVC Research
- 清华“神奇药水”登Nature:逆转干细胞分化,比诺奖成果更进一步,网友:不靠精子卵子就能创造生命了?!...
- R language plot visualization: plot visualizes the normalized histogram, adds the density curve KDE to the histogram, and uses geom at the bottom edge of the histogram_ Adding edge whisker graph with
- NFT transaction principle analysis (1)
- 精致妆容成露营“软实力”,唯品会户外美妆护肤产品销量激增
- NFT transaction principle analysis (2)
- NFT contract basic knowledge explanation
- What is the process of switching C # read / write files from user mode to kernel mode?
- Leetcode one week race 298, first three questions
- NFT 平台安全指南(1)
猜你喜欢
随机推荐
6 自定义层
零知识 QAP 问题的转化
MHA switching (recommended operation process)
请指教同花顺软件究竟是什么?网上开户是否安全么?
NFT transaction principle analysis (1)
Selenium chrome disable JS disable pictures
The first batch in the industry! Tencent cloud security and privacy computing products based on angel powerfl passed CFCA evaluation
8 user defined evaluation function
Ideal path problem
Angel 3.2.0 new version released! Figure the computing power is strengthened again
Swiftui retrieves the missing list view animation
Big talk Domain Driven Design -- presentation layer and others
Tweenmax+svg switch color animation scene
OpenSea上如何创建自己的NFT(Polygon)
【力扣刷题】单调栈:84. 柱状图中最大的矩形
R language uses cor function to calculate the correlation matrix for correlation analysis, uses corrgram package to visualize the correlation matrix, reorders rows and columns using principal componen
Solana capacity expansion mechanism analysis (1): an extreme attempt to sacrifice availability for efficiency | catchervc research
IAR工程适配GD32芯片
人人都当科学家之免Gas体验mint爱死机
Analyse panoramique de la chaîne industrielle en amont, en aval et en aval de la NFT « Dry goods»