Redis inventory 10, mysql inventory ten, but now one sent 10 seconds kill, redis=0 mysql=10, a redis success=0, mysql=9.
So others can not seconds killed, and only sell a commodity,
CodePudding user response:
This idempotence, i.e., the same operation, no matter how many times repeatedly, the result should be consistent,Sent back to you this question, one of 10 seconds to kill, it should be equivalent to sending a second, then you should record in redis once the user of a unique identifier, to identify if it made seconds kill activity,
Seconds kill success, the same mysql also should make records, avoid service restart causes such as cache misses, repeated down the situation,