[wordpress插件] Async Background Worker异步后台工作者

wordpress 插件 文章 2020-02-22 10:40 567 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

Async Background Worker, more information please visit this page https://

异步后台工作者,更多信息,请访问此页面 https://

tonjoo.github.io/async-background-worker/

tonjoo.github.io/async-background-worker/

Sample Usage

样品用量

What is it ?

是什么?

WordPress background worker plugin that enable WordPress to interact with beanstalkd work queue.

WordPress后台工作人员插件,使WordPress可以与beantalkd工作队列进行交互。

Why we need a worker ?

为什么我们需要一个工人?

We can run a very long task in the background, for example we need to import 100.000 row into WordPress databases.

我们可以在后台运行很长的任务,例如,我们需要将100.000行导入WordPress数据库。

Instead of doing the 100.000 import in one job, we can separate the job into many smaller job which is safer.

除了将10万个工作导入一个工作之外,我们还可以将工作分为许多更安全的较小工作。

WP-CLI

WP-CLI

Make sure you have WP CLI installed on your system

确保系统上已安装WP CLI

Support Forum

支持论坛

https://forum.tonjoostudio.com/

https://forum.tonjoostudio.com/

thread-category/async-background-worker/

thread-category / async-background-worker /

Add job to queue

将作业添加到队列

    1. Add new job to new worker queue using add_async_job command

      使用 add_async_job 命令将新作业添加到新的工作人员队列

      $job = new stdClass();

        $ job = new stdClass();

      // the function to run

      //要运行的函数

      $job->function = 'function_to_execute_on_background';

      $ job-> function ='function_to_execute_on_background';

      // our user entered data

      //我们的用户输入的数据

      $job->user_data = array('data'=>'some_data');

      $ job-> user_data = array('data'=>'some_data');

      add_async_job($job);

      add_async_job($ job);

    2. Implement function

      执行功能

      function function_to_execute_on_background($data) {    

        function function_to_execute_on_background($ data){    

      //do something usefull    

      //做一些有用的事情    

      echo "Background job executed successfully\n";

      回显“后台作业成功执行\ n”;

      }

      }

    3. Run wp background-worker listen

      运行 wp后台工作者监听

    Command

    命令

      • wp background-worker

        wp后台工作者

        Run Async Background Worker once.

        一次运行异步后台工作程序。

      • wp background-worker listen

        wp后台工作者监听

        Run Async Background Worker in loop (contiously), this is what you want for background worker.

        (连续)循环运行Async Background Worker(连续地),这就是您想要的Background Worker。

        WordPress framework is restart in each loop.

        WordPress框架会在每个循环中重新启动。

      • wp background-worker listen-daemon

        wp后台工作者监听守护程序

        Run Async Background Worker in loop (contiously) without restart the WordPress framework.

        循环(连续)运行Async Background Worker(连续地),而无需重新启动WordPress框架。

        NOTE if you use this mode, any code change will not be reflected.

        注意(如果使用此模式,则不会反映任何代码更改)。

        You must restart the Async Background Worker each time you change code.

        每次更改代码时,都必须重新启动“异步后台工作器”。

        This save memory and speed up thing.

        这样可以节省内存并加快速度。

下载地址
https://downloads.wordpress.org/plugin/async-background-worker.zip
-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
[wordpress插件] Customize Widgets Plus自定义小部件加
[wordpress插件] Advanced Rich Text Tools for Gutenberg适用于古腾堡的高级富文本工具
[wordpress插件] azurecurve Mobile Detection天蓝色曲线移动检测
[wordpress插件] Admin Classic Borders管理员经典边框
[wordpress插件] Buzz for Video Game Award Programs电子游戏奖励计划的热门话题
随便看看
企业微信通讯录账号被管理员误/恶意删除,怎么办? 8232
问题? 7457
如何快速搭建抽奖助手小程序(无需代码知识) 5134
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 6091
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 5701
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 5283
如何解决渲染层网络错误Failed to load media? 16629
小程序找号找回 释放昵称? 2476
我的小程序广告主收入5301,实际进账4406,是怎么回事呀? 2553
删除部分微信用户个人数据的通知,怎么删除? 5604