Home > Backend Development > PHP Tutorial > What does laravel's queue mean and what is its implementation principle?

What does laravel's queue mean and what is its implementation principle?

WBOY
Release: 2016-09-08 08:44:07
Original
1420 people have browsed it

What does laravel's queue mean, what is the implementation principle, and what scenarios generally use queues?

Reply content:

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>
Copy after login
The most common thing encountered is the push notification of the App. When the App user group triggers many operations, the target users must be notified. It is impossible to execute the push code for every operation. This will reduce the processing speed of the interface and the user will perform these operations. The operation does not need to know whether the target user has been notified as long as the operation is successful. Instead, these operation data are inserted into a storage (

memcache, redis, etc.), and then a process is opened to execute the storage. Data push.

Laravel 5.2 Service-Queue

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template