php - How to ensure data security when one operation requests multiple services?
我想大声告诉你
我想大声告诉你 2017-05-25 15:08:18
0
3
797

An order operation to purchase goods.
To reduce user points at the same time, insert an order.
In the same library, you can add pessimistic locking to the points table to prevent concurrently generated data from being read multiple times.
Now that HTTP is used to request points service and order service, how to use locking? To prevent reducing the points into negative numbers

==================
The items are point services, points services, and order services. The database is also separate. The lock doesn't work

我想大声告诉你
我想大声告诉你

reply all(3)
我想大声告诉你

Can use transaction mechanism

迷茫

Points can be made using redis

巴扎黑

You have to consider whether there will be concurrency problems. If there are concurrency problems, it is recommended to put queues + things for processing.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!