What does laravel's queue mean, what is the implementation principle, and what scenarios generally use queues?
What does laravel's queue mean, what is the implementation principle, and what scenarios generally use queues?
The queue here should refer to the message queue. The operations of the queue include enqueue and dequeue. That is, you have a program that generates content and then enqueues it (producer)
Another program reads the content and the content is dequeued (consumer).
And when should the queue be used?
<code>当你不需要立即获得结果,但是并发量又不能无限大的时候,差不多就是你需要使用消息队列的时候。 </code>
memcache,
redis, etc.), and then a process is opened to execute the storage. Data push.
It is the queue in the data structure. The typical operation method is first in first out. All tasks with (first in first out) requirements can use this data structure.
For more knowledge about the queue data structure, you can search by yourself Engine search. Because queues also have circular queues, priority queues and other categories. The principle of implementation is actually to implement the general operations of the queue, such as enqueuing and enqueuing. Generally, multiple drivers are implemented. The so-called driver is What method is used to implement the queue. For example, text file method, DB method, redis, monolog.
Usage scenarios are generally tasks that need to be queued, such as grabbing tickets, flash sales, etc.