Client.phpView Source

Show: PublicProtectedPrivateinherited
Table of Contents
Interface for Danga's Gearman job scheduling system

PHP version 5.1.0+ 7+

LICENSE: This source file is subject to the New BSD license that is available through the world-wide-web at the following URI: http://www.opensource.org/licenses/bsd-license.php. If you did not receive a copy of the New BSD License and are unable to obtain it through the web, please send a note to license@php.net so we can mail you a copy immediately.

Author
Joe Stump  
Category
Net  
Copyright
2007-2008 Digg.com, Inc.  
License
New BSD License  
Link
http://pear.php.net/package/Net_Gearman  
Link
http://www.danga.com/gearman/  
Package
ShSo\Net\Gearman  
Version
CVS: $Id$  

\ShSo\Net\Gearman\Client

Package: ShSo\Net\Gearman
A client for submitting jobs to Gearman

This class is used by code submitting jobs to the Gearman server. It handles taking tasks and sets of tasks and submitting them to the Gearman server.

Author
Joe Stump  
Category
Net  
Copyright
2007-2008 Digg.com, Inc.  
License
New BSD License  
Link
http://www.danga.com/gearman/  
Version
Release: @package_version@  

Properties

>VPropertyprotectedresource $conn = array()
Our randomly selected connection
Default valuearray()Details
Type
resource
>VPropertyprotectedarray $servers = array()
A list of Gearman servers
Default valuearray()Details
Type
array
>VPropertyprotectedinteger $timeout = 1000
The timeout for Gearman connections
Default value1000Details
Type
integer

Methods

methodpublic__call(string $func, array $args = array()) : void

Fire off a background task with the given arguments

Parameters
NameTypeDescription
$funcstring

Name of job to run

$argsarray

First key should be args to send

Details
See
ShSo\Net\Gearman\Set  
methodpublic__construct(array $servers = null, integer $timeout = 1000) : void

Constructor

Parameters
NameTypeDescription
$serversarray

An array of servers or a single server

$timeoutinteger

Timeout in microseconds

Throws
ExceptionDescription
\ShSo\Net\Gearman\ShSo\Net\Gearman\Exception
Details
See
 
methodpublic__destruct() : void

Destructor

methodpublicdisconnect() : void

Disconnect from Gearman

methodprotectedgetConnection() : resource

Get a connection to a Gearman server

Returns
TypeDescription
resourceA connection to a Gearman server
methodprotectedhandleResponse(array $resp, resource $s, object $tasks) : void

Handle the response read in

Parameters
NameTypeDescription
$resparray

The raw array response

$sresource

The socket

$tasksobject

The tasks being ran

Throws
ExceptionDescription
\ShSo\Net\Gearman\ShSo\Net\Gearman\Exception
methodpublicrunSet(object $set, integer $timeout = null) : void

Run a set of tasks

Parameters
NameTypeDescription
$setobject

A set of tasks to run

$timeoutinteger

Time in seconds for the socket timeout. Max is 10 seconds

Details
See
ShSo\Net\Gearman\Task  
methodprotectedsubmitTask(object $task) : void

Submit a task to Gearman

Parameters
NameTypeDescription
$taskobject

Task to submit to Gearman

Details
See
ShSo\Net\Gearman\Client::runSet()  
Documentation was generated by phpDocumentor 2.8.5.