1. Once a mall user purchases a product and generates an order, they modify the mall inventory. At this time, should they directly modify the database data or cache the inventory value of the product first and then modify the cached value globally and wait until a certain time? Write to database?
2. How to lock for concurrent processing
天蓬老师2017-05-16 13:05:36
When the amount of access is large, it is not good to perform frequent read and write operations on the database. It is recommended to use the cache layer and use the queue to update in batches at the same time.
As for the locking issue (I don’t have any substantive suggestions), I generally adopt pessimistic locking. . .