当前位置:网站首页>[summary of interview questions] zj6 redis
[summary of interview questions] zj6 redis
2022-06-24 02:59:00 【Hello y】
redis Common commands
What are various data types commonly used for
String: Can be used for caching 、 Distributed Session
Hash: Can be used to store user information 、 User home page visits 、 Combination query
(hash Better for storing objects , Store an object in hash Type will take up less memory , And easy access to the entire object .)
hmset myhash field1 value1 field2 value2: Set up multiple field
List: Timeline list of Weibo followers , Simple queue
Set: Fabulous 、 Step on 、 Friend relationship ( You can find intersection union difference sets )
Zset: Ranking List
exists key Judge whether it exists key
expire key 10 10s Be overdue
redis General Command
Redis Operation command summary
redis Save a decimal 1.5 How to add one
incrbyfloat Add or subtract floating point numbers
Be careful :incr Is integer increment
redis If it exists, operate the command
set key value Just insert when it doesn't exist , exist iju Modify .
Be careful :
setnx key value If it does not exist, perform the operation , There is no operation
setex key time value Set expiration time (expire)
redis Message queue of list aggregate , How do producers and consumers know if there is any news inside
Redis Of List The main operations of are lpush/lpop/rpush/rpop Four kinds of , From the head and from the tail push/pop, besides List There are also two pop Blocking version of the operation blpop/brpop, Used to block getting an object (list When there is no data hi Blocked ).
Redis It is usually used as a message server to handle background work or message tasks . A simple queue mode : The producer puts the message into a list , Consumers waiting for news use rpop command ( By polling ), Or use brpop To get the news .
In order to prevent data loss and inconsistency ( That is, the consumer just took out the message and collapsed , Message not processed ), use rpoplpush command : Not only does it return a message, it also adds the message to another backup list , If everything goes well , After the client finishes processing the message , use rem Delete the corresponding message from this sub table . If it fails, the message will be bounced back from the backup table to the original queue rpoplpush
Java Jedis operation Redis Example ( Two )——list producer / The consumer pattern implements message queuing
边栏推荐
- How to understand EDI requirements of trading partners
- Easycvr cannot be played when cascaded to the superior platform. Troubleshooting
- UI automation based on Selenium
- Ner's past, present and future Overview - past
- [51nod] 2102 or minus and
- Tencent cloud CVM starts IPv6
- Is your posture correct—— A detailed discussion on horizontal sub database and sub table
- Tencent dongzhiqiang: network security construction needs to change from product driven to service driven
- Simple use of notification
- [51nod] 2106 an odd number times
猜你喜欢

Permission maintenance topic: domain controller permission maintenance

IOS development - multithreading - thread safety (3)

UI automation based on Selenium

The cost of on-site development of software talent outsourcing is higher than that of software project outsourcing. Why
![[51nod] 3216 Awards](/img/94/fdb32434d1343040d711c76568b281.jpg)
[51nod] 3216 Awards

2022-2028 global cell-based seafood industry research and trend analysis report

2022-2028 global cancer biopsy instrument and kit industry research and trend analysis report
![[51nod] 2102 or minus and](/img/68/0d966b0322ac1517dd2800234d386d.jpg)
[51nod] 2102 or minus and

2022-2028 Global Industry Survey and trend analysis report on portable pressure monitors for wards
![[51nod] 2653 section XOR](/img/2d/cb4bf4e14939ce432cac6d35b6a41b.jpg)
[51nod] 2653 section XOR
随机推荐
How to view the speech synthesis platform how to use the speech synthesis platform
2022-2028 global third-party data platform industry research and trend analysis report
2022-2028 global medical modified polypropylene industry research and trend analysis report
What is the meaning of scdo? Is it comparable to bGH
Afnetworking usage and cache processing
Is the cloud desktop server highly required for installation and configuration? Is cloud desktop easy to use?
How to design and make ppt gradient effect?
How to access easynvr management platform through web pages without data?
How to use nsfilemanager
Heavy release! Tencent security hosting service TA is here!
2022-2028 global pilot night vision goggle industry research and trend analysis report
Objective-C downloads pictures from the network, saves them, and displays them from the save with uiimageview
How to bind EIP to access public network in tke cluster fixed IP mode pod
Tke single node risk avoidance
Easycvr cannot be played when cascaded to the superior platform. Troubleshooting
SAP retail characteristic profile I
How to handle the occasional address request failure in easygbs live video playback?
The reason why SAS fortress cannot connect to the server
[51nod] 3047 displacement operation
How much does it cost to rent a cloud game server? Which cloud game server is more reliable?
