当前位置:网站首页>Redis set command line operation (intersection, union and difference, random reading, etc.)
Redis set command line operation (intersection, union and difference, random reading, etc.)
2022-07-02 02:55:00 【Procedural ape (siege lion)】
Here to redis Of set Simple demonstration of how to use the command , It is helpful to understand the meaning and usage of relevant commands . Actual business scenarios should be combined redis The interface provided by the client performs relevant operations .
1. Add one set The order of sadd
127.0.0.1:6379> sadd setA 1 2 3
(integer) 3
127.0.0.1:6379> sadd setB 2 3 4
(integer) 32. Calculate two set The difference between the set
127.0.0.1:6379> sdiff setA setB
1) "1"
127.0.0.1:6379> sdiff setB setA
1) "4"3. Calculate two set Intersection
127.0.0.1:6379> sinter setA setB
1) "2"
2) "3"4. utilize set Realize random lottery
127.0.0.1:6379> SADD order 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010
(integer) 10
127.0.0.1:6379> SMEMBERS order
1) "1001"
2) "1002"
3) "1003"
4) "1004"
5) "1005"
6) "1006"
7) "1007"
8) "1008"
9) "1009"
10) "1010"
127.0.0.1:6379> SPOP order 3
1) "1001"
2) "1003"
3) "1006"
127.0.0.1:6379> SPOP order 2
1) "1004"
2) "1002"
127.0.0.1:6379> SPOP order 1
1) "1007"Add data to the set , Then view the data list in the collection , Random sampling 3 individual 、2 And 1 Data .
5. Like the model
127.0.0.1:6379> SADD like:1 1001 1002 1003 1004 1005
(integer) 5
# Delete attention
127.0.0.1:6379> SREM like:1 1002
(integer) 1
# Judge whether to pay attention to
127.0.0.1:6379> SISMEMBER like:1 1002
(integer) 0
127.0.0.1:6379> SISMEMBER like:1 1005
(integer) 1
# Check out the following list
127.0.0.1:6379> SMEMBERS like:1
1) "1001"
2) "1003"
3) "1004"
4) "1005"
# Check the number of followers
127.0.0.1:6379> SCARD like:1
(integer) 4边栏推荐
- Xiaomi, a young engineer, was just going to make soy sauce
- 2022 low voltage electrician test question simulation test question bank simulation test platform operation
- A list of job levels and salaries in common Internet companies. Those who have conditions must enter big factories. The salary is really high
- [staff] restore mark (Introduction to the use of restore mark | example analysis of Metaphone mark and restore mark)
- Realize the code scanning function of a custom layout
- Connected block template and variants (4 questions in total)
- 使用 useDeferredValue 进行异步渲染
- AcWing 245. Can you answer these questions (line segment tree)
- [staff] diacritical mark (ascending sign | descending sign B | double ascending sign x | double descending sign BB)
- buu_ re_ crackMe
猜你喜欢

Multi threaded query, double efficiency

使用 useDeferredValue 进行异步渲染
![[question 008: what is UV in unity?]](/img/f7/5ee0b18d1fe21ff3b98518c46d9520.jpg)
[question 008: what is UV in unity?]

Ten minutes will take you in-depth understanding of multithreading - multithreaded teamwork: synchronous control
![[staff] pitch representation (treble clef | C3 60 ~ B3 71 pitch representation | C4 72 pitch representation | C5 84 pitch representation)](/img/e0/05890eafdb291c5aaff78cc241f455.jpg)
[staff] pitch representation (treble clef | C3 60 ~ B3 71 pitch representation | C4 72 pitch representation | C5 84 pitch representation)

Pychart creates new projects & loads faster & fonts larger & changes appearance

Summary of some experiences in the process of R & D platform splitting

2022-2028 global nano abrasive industry research and trend analysis report

2022-2028 global encryption software industry research and trend analysis report

Feature query of hypergraph iserver rest Service
随机推荐
Delphi xe10.4 installing alphacontrols15.12
[Chongqing Guangdong education] Sichuan University concise university chemistry · material structure part introductory reference materials
MongoDB非關系型數據庫
[learn C and fly] 1day Chapter 2 (exercise 2.2 find the temperature of Fahrenheit corresponding to 100 ° f)
[opencv] - comprehensive examples of five image filters
Which brand of running headphones is good? How many professional running headphones are recommended
[reading notes] programmer training manual - practical learning is the most effective (project driven)
AcWing 245. Can you answer these questions (line segment tree)
The capacity is upgraded again, and the new 256gb large capacity specification of Lexar rexa 2000x memory card is added
[punch in questions] integrated daily 5-question sharing (phase II)
使用开源项目【Banner】实现轮播图效果(带小圆点)
Provincial election + noi Part IV graph theory
What kind of good and cost-effective Bluetooth sports headset to buy
C return multiple values getter setter queries the database and adds the list return value to the window
GB/T-2423. XX environmental test documents, including the latest documents
STM32__05—PWM控制直流电机
LeetCode刷题(十)——顺序刷题46至50
Remote connection to MySQL under windows and Linux system
Possible causes of runtime error
Leetcode question brushing (10) - sequential question brushing 46 to 50