For example, php mall now uses the method for users to freeze the goods they place after placing an order. The frozen time is 15 minutes. The question now is how to unfreeze the goods that have expired and unpaid orders. I can write a thawing program, but the question is, when will this program be triggered? Because this unfreeze program must be locked...
Now I am using this method. After placing an order, the user will freeze the goods ordered for 15 minutes. Now the question is how to unfreeze the expired and unpaid goods.
I can write a thawing program, but the question is, when will this program be triggered? Because this unfreeze program must lock the Table query, will it cause a huge database burden if any place with inventory is triggered?
Reply content:
Example: php mall
Now I am using this method. After placing an order, the user will freeze the goods ordered for 15 minutes. Now the question is how to unfreeze the expired and unpaid goods.
I can write a thawing program, but the question is, when will this program be triggered? Because this unfreeze program must lock the Table query, will it cause a huge database burden if any place with inventory is triggered?
1: The operation time can be used to determine whether there is a product to be restored when the user visits a specific product page; it can also be used to determine whether the order is valid for 15 minutes and whether there is an order to be restored for the product corresponding to the order, and whether the expiration time is appropriate in combination with memcache.
2: scheduled tasks (usually executed when there is a small amount of traffic), but certainly not any inventory of goods/places, should be purchased by someone.
3: If you need to restore too much data, you can consider using redis. The key is the order ID, and the value is the expiration time. You can regularly run the order here.
Waiting for a master ~
Try to add a field table that the product has been frozen and the time for saving and unfreezing the table. You must take this field into account during operations. This should be fine...