redis - How does PHP prevent multiple processes from operating the same resource at the same time?
滿天的星座2017-05-16 13:18:57
0
4
727
How does PHP prevent multiple processes from operating the same resource at the same time? For example: flash sale products in the mall? Stock lock? Avoid oversold inventory? What is the principle?
For example, if you have 10 products to be sold in a flash sale, you can create a queue and give flash sales to the first 10 items in the queue, and the subsequent ones will be returned to flash sales and fail~
For example, if you have 10 products to be sold in a flash sale, you can create a queue and give flash sales to the first 10 items in the queue, and the subsequent ones will be returned to flash sales and fail~
You can use redis queue
kafka you deserve
redis optimistic lock