Ask a question about the inventory of Synchronize in a mall.

topic description

at present, there is a product that the user places an order to reduce inventory, the order is cancelled to increase inventory, and the backend modifies the inventory quantity. There are three different ways to do this. How about Synchronize? Database lock?

topic sources and their own ideas

I wonder if it can be achieved through database optimistic locks, but wouldn"t it be impossible if the version numbers obtained before and after operations within the same transaction are the same? Write a special method to get the version number?

do you have a boss to give me ideas?

Jun.26,2021

what if you do it for me
button operation:
1.redis button
2. Asynchronous message update database
release / update operation
1. Update table
2. Synchronize / Asynchronous Update redis

Menu