PHP Class Resque\Host

Author: Michael Haynes ([email protected])
Show file Open project: mjphaynes/php-resque Class Usage Examples

Protected Properties

Property Type Description
$hostname The hostname
$redis The Redis instance
$timeout Host key timeout

Public Methods

Method Description
__construct ( $hostname = null ) Create a new host
__toString ( ) : string Generate a string representation of this worker.
cleanup ( ) : array Cleans up any dead hosts
finished ( Worker $worker ) Mark host as having a finished worker
redisKey ( Host $host = null, string $suffix = null ) : string Get the Redis key
working ( Worker $worker ) Mark host as having an active worker

Method Details

__construct() public method

Create a new host
public __construct ( $hostname = null )

__toString() public method

Generate a string representation of this worker.
public __toString ( ) : string
return string Identifier for this worker instance.

cleanup() public method

Cleans up any dead hosts
public cleanup ( ) : array
return array List of cleaned hosts

finished() public method

Mark host as having a finished worker
public finished ( Worker $worker )
$worker Worker The worker instance

redisKey() public static method

Get the Redis key
public static redisKey ( Host $host = null, string $suffix = null ) : string
$host Host The host to get the key for
$suffix string To be appended to key
return string

working() public method

Mark host as having an active worker
public working ( Worker $worker )
$worker Worker the worker instance

Property Details

$hostname protected property

The hostname
protected $hostname

$redis protected property

The Redis instance
protected $redis

$timeout protected property

Host key timeout
protected $timeout