Currently, it is a bit technical. In php code, all the arrays requiring the request interface are put into the redis storage, and then the array brpop is cyclically generated. but isn't this process executed by php code? After php times out, the entire process is not interrupted yet? Currently, it is a bit technical.
In the php code, put all the arrays requiring the request interface into the redis storage,
Then we use a loop to pop the array. but isn't this process executed by php code?
After php times out, the entire process is not interrupted yet?
Reply content:
Currently, it is a bit technical.
In the php code, put all the arrays requiring the request interface into the redis storage,
Then we use a loop to pop the array. but isn't this process executed by php code?
After php times out, the entire process is not interrupted yet?
Start a php script and run it on the command line.
Upstairs.
For example. Redis is A data pool, and both A and B can connect to it. A is your current task. it is only responsible for writing data to Redis, B is another task (for example, Charles started an endless loop script using the command line method). B is only responsible for querying/deleting mail data in Redis.
Dead Loop script pseudo code:
Set_timelimit (0); // enables this PHP program to execute while (true) without a limited time {$ row = $ redisInstance-> shiftGroup ('email '); // if all the emails to be sent are an array, retrieve the first if (empty ($ row) {sleep (1); // rest for 1 second continue ;} sendMail ($ row );}
You can use Redis's Pub/Sub mechanism to establish a simple message queue using NodeJS.
Redis. subscribe ('email ', 'MS', 'Push', function (err, count) {}); redis. on ('message', function (chan, msg) {// process the message to be sent });