PHP Class Resque\Queue

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

Protected Properties

Свойство Type Description
$default The name of the default queue
$redis The Redis instance

Méthodes publiques

Méthode Description
__construct ( string $default = null ) Create a new queue instance
job ( string $id ) : Job Get a job by id
later ( integer $delay, string $job, array $data = [], string $queue = null ) : Job Queue a job for later retrieval. Jobs are unique per queue and are deleted upon retrieval. If a given job (payload) already exists, it is updated with the new delay.
pop ( array $queues, integer $timeout = 10, boolean $blocking = true ) : Job | false Pop the next job off of the queue.
push ( string $job, array $data = null, string $queue = null ) : Job Push a new job onto the queue
redisKey ( Queue | null $queue = null, string | null $suffix = null ) : string Get the Queue key
size ( string $queue ) : integer Return the size (number of pending jobs) of the specified queue.
sizeDelayed ( string $queue ) : integer Return the size (number of delayed jobs) of the specified queue.

Méthodes protégées

Méthode Description
getQueue ( string | null $queue ) : string Get the queue or return the default.

Method Details

__construct() public méthode

Create a new queue instance
public __construct ( string $default = null )
$default string Name of default queue to add job to

getQueue() protected méthode

Get the queue or return the default.
protected getQueue ( string | null $queue ) : string
$queue string | null Name of queue
Résultat string

job() public méthode

Get a job by id
public job ( string $id ) : Job
$id string Job id
Résultat Job job instance

later() public méthode

Queue a job for later retrieval. Jobs are unique per queue and are deleted upon retrieval. If a given job (payload) already exists, it is updated with the new delay.
public later ( integer $delay, string $job, array $data = [], string $queue = null ) : Job
$delay integer This can be number of seconds or unix timestamp
$job string The job class
$data array The job data
$queue string The queue to add the job to
Résultat Job job instance

pop() public méthode

Pop the next job off of the queue.
public pop ( array $queues, integer $timeout = 10, boolean $blocking = true ) : Job | false
$queues array Queues to watch for new jobs
$timeout integer Timeout if blocking
$blocking boolean Should Redis use blocking
Résultat Job | false

push() public méthode

Push a new job onto the queue
public push ( string $job, array $data = null, string $queue = null ) : Job
$job string The job class
$data array The job data
$queue string The queue to add the job to
Résultat Job job instance

redisKey() public static méthode

Get the Queue key
public static redisKey ( Queue | null $queue = null, string | null $suffix = null ) : string
$queue Queue | null the worker to get the key for
$suffix string | null to be appended to key
Résultat string

size() public méthode

Return the size (number of pending jobs) of the specified queue.
public size ( string $queue ) : integer
$queue string name of the queue to be checked for pending jobs
Résultat integer The size of the queue.

sizeDelayed() public méthode

Return the size (number of delayed jobs) of the specified queue.
public sizeDelayed ( string $queue ) : integer
$queue string name of the queue to be checked for delayed jobs
Résultat integer The size of the delayed queue.

Property Details

$default protected_oe property

The name of the default queue
protected $default

$redis protected_oe property

The Redis instance
protected $redis