How to deal with High concurrency problem with PHP FIFO

for example, you can only vote once. The program first searches whether he has voted, and then inserts records if not.
if the user votes with a concurrent tool, he can cast multiple votes if no data is found in multiple requests during the check.

can you package the code {select insert} first-in-first-out (FIFO). Only one user can go in and execute this code

Php
Mar.21,2021

store the voting information in the redis queue, and take the first vote as the standard, and then go to redis to check it. If others refuse to vote, the front end will invalidate it after clicking the button


use the redis lock to ensure that a single process is available on the Internet. Take advantage of the atomicity of redis


queue to learn about it, and use a list maintenance team with redis,. Rpush to list after each voting request arrives, and then understand that the reply is successful. The server terminal runs a php script, and while a loop,blpop list, to get the information and process it. So we can deal with one at a time.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e452a6-43a8a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e452a6-43a8a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?