Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
W
wiki-php
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • 互联网应用开发
  • wiki-php
  • Wiki
  • php job queue

php job queue · Changes

Page history
wangchangchun created page: php job queue authored Nov 22, 2019 by 王常春's avatar 王常春
Show whitespace changes
Inline Side-by-side
Showing with 9 additions and 0 deletions
+9 -0
  • php-job-queue.md php-job-queue.md +9 -0
  • No files found.
php-job-queue.md
View page @ 05a525f8
# php多任务并发处理队列
## PHP并发队列原理
首先在php下编写job,在`app-job\bin\`目录下实现对应的job类,然后在需要使用的地方将任务依次加入队列。python脚本会依次从队列里面取出任务去执行。
## Job类
参考`Bin_Wiki_UpdateCertWebsiteExpire`.注意这里它即实现了生产者也实现了消费者逻辑,`start_general_queue`函数将需要执行的任务依次加入队列,`add_queue`则依次消费完成任务。
## 任务加入队列
任务加入队列,就是加入redis的一个list队列,此处可以使用`GlobalFun::add_python_job($job_class, $args=[], $queue_name='default', $is_urgent=false)`.
Clone repository
  • 360safeguardnativeapi
  • all new classmate
  • bind phone
  • code standard
  • deploy_sys
  • edit common
  • edit master
  • envrioment
  • find psw
  • front new classmate
  • front statck
  • git
  • Home
  • idcard md5
  • ide
View All Pages