GearmanWorker 类

(PECL gearman >= 0.5.0)

简介

类概要

class GearmanWorker {
/* 方法 */
public __construct()
public addFunction(
    string $function_name,
    callable $function,
    mixed $context = null,
    int $timeout = 0
): bool
public addOptions(int $option): true
public addServer(string $host = null, int $port = 0, bool $setupExceptionHandler = true): bool
public addServers(string $servers = null, bool $setupExceptionHandler = true): bool
public error(): string|false
public getErrno(): int
public options(): int
public register(string $function_name, int $timeout = 0): bool
public removeOptions(int $option): true
public returnCode(): int
public setId(string $id): bool
public setOptions(int $option): true
public setTimeout(int $timeout): true
public timeout(): int
public unregister(string $function_name): bool
public wait(): bool
public work(): bool
}

目录

添加注释

用户贡献的注释 2 个注释

szhvoj@gmail!com
1 年前
使用 systemd 管理此进程

---- 8< ---- /lib/systemd/system/gearman-worker.service
[Unit]
Description=我的 Gearman 工作者

[Service]
ExecStart=/usr/bin/php /var/www/my-worker.php
Restart=always

[Install]
WantedBy=multi-user.target
---- >8 ---- /lib/systemd/system/gearman-worker.service
systemctl daemon-reload
systemctl enable gearman-worker
systemctl start gearman-worker
spacewalker2002 at ukr dot net
11 年前
对于后台运行,使用

exec("nohup php worker.php >/dev/null 2>/dev/null &");
To Top