search

Home  >  Q&A  >  body text

redis - How does PHP prevent multiple processes from operating the same resource at the same time?

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?

滿天的星座滿天的星座2835 days ago834

reply all(4)I'll reply

  • 滿天的星座

    滿天的星座2017-05-16 13:20:57

    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~

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-16 13:20:57

    You can use redis queue

    reply
    0
  • 迷茫

    迷茫2017-05-16 13:20:57

    kafka you deserve

    reply
    0
  • 迷茫

    迷茫2017-05-16 13:20:57

    redis optimistic lock

    reply
    0
  • Cancelreply