Installation and configuration :

* Yes Composer Install , command :composer require topthink/think-queue( Version plus =2.0.*)
* The configuration file is located in application/extra/queue.php( The types used in this article are Redis)
* configuration file application/extra/queue.php return [ 'connector' => 'Redis', 'expire' =
> 180, // Task expiration time , To disable, set to null 'default' => 'default', // Default queue name 'host' =>
'127.0.0.1', 'port' => '6379', 'password' => '', 'select' => 6, // redis db
'timeout' => 0, // redis Connection timeout 'persistent' => false, // Is it a long connection ];
4. newly build application/index/controller/MyQueue.php
namespace app\index\controller; use think\Controller; use think\Queue; class
MyQueue extends Controller { public function index($job_data, $type = 'push')
//jio_data Data to be sent { $job_class = "app\index\job\Message@deal"; // Task class -
The deal method $job_queue_name = 'Check';// Queue name switch ($type) { case 'later':
$is_push = Queue::later(5, $job_class, $job_data, $job_queue_name); // Delay sending task 5 second
break; case 'push': $is_push = Queue::push($job_class, $job_data,
$job_queue_name); // Send task now break; } if ($is_push !== false) { echo date('Y-m-d
H:i:s') . " New tasks " . "<br>"; } else { echo ' New task error '; } } }
5. newly build application/index/job/Message.php( Corresponding calling method )
namespace app\index\job; use app\index\model\newsinfo; use think\queue\Job;
class Message { /* processing logic */ public function deal(Job $job, $data) {
// Task execution exceeds 1 second , Then delete the task $nums=$job->attempts(); if ($nums >0) { $job->delete(); } $job-
>delete(); } } // At the end of each execution Job After that delete fall , Or he'll do it over and over again
//$job->attempts() Just to get the queue to return data The number of times this data is executed , The delay queue will not be executed until it arrives deal The value of this function , Entering means executing this data ,attempts The number of times you fail to execute will only occur , Or is it finished delete Will +1
//push It's a normal queue later It's a delay queue The execution process can be completed through Log::write() View with log

Technology
©2019-2020 Toolsou All rights reserved,
java Comparing attribute values between two objects utilize Python handle Excel data ——xlrd,xlwt library Bidirectional linked list Why? Python Not a future oriented programming language ?Python【 Assignment statement 】 Special lecture , You can't just a=b ah ! Suggest mastering ! utilize Python handle Excel data ——pandas library see SQL-SERVER Data volume and occupied space of database and each table PID The algorithm finally figured out the principle , It was so simple web Two front-end practical games ( Attached source code ) Beginners learn Python Be sure to know what his basic algorithms are ? What is the function ?