How can I store links crawled by php crawlers into queues?

Source: Internet
Author: User
After writing the extended link function, how do I write the function that stores the link as a queue? {Code...} a video says that the function of the Link Library includes: 1. Store the link; 2. Remove the link; 3. Set the priority of the link. Practical solutions include: 1. stored in the database; 2. redis; 3. Memory set; 4... after the extended link function is written, how can I write the function that stores the link as a queue?

// Extended link function public function extractLink ($ page) {$ matches = array (); $ pat = "# href = \" (http: // xxxx/yyy/zzz. php \? Id = \ d + $) \ "# I"; preg_match_all ($ pat, $ page, $ matches, PREG_PATTERN_ORDER); for ($ I = 0; $ I
  

The function of a link library in a video includes: 1. Store links; 2. deduplicate links; 3. set priority for links.
Practice solutions: 1. stored in the database; 2. redis; 3. Memory set; 4. queue.
However, if there is a problem with the video, there will be no content later.

Reply content:

After writing the extended link function, how do I write the function that stores the link as a queue?

// Extended link function public function extractLink ($ page) {$ matches = array (); $ pat = "# href = \" (http: // xxxx/yyy/zzz. php \? Id = \ d + $) \ "# I"; preg_match_all ($ pat, $ page, $ matches, PREG_PATTERN_ORDER); for ($ I = 0; $ I
   

The function of a link library in a video includes: 1. Store links; 2. deduplicate links; 3. set priority for links.
Practice solutions: 1. stored in the database; 2. redis; 3. Memory set; 4. queue.
However, if there is a problem with the video, there will be no content later.

What videos? What tutorial? What are you talking about?

The queue is not saved as an array, and then does array_shift and array_push?

Try beanstalk.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.