Definition at line 5 of file Worker.php.
◆ create()
create |
( |
|
$class_name, |
|
|
|
$id, |
|
|
|
$config = null , |
|
|
|
$time = null , |
|
|
|
$interval = null |
|
) |
| |
|
protected |
Create a job object.
- Parameters
-
string | $class_name | Class name for the job. |
string | $id | Unique ID for the job. |
array | $config | Configuration options (key-value pairs) for the job. |
int | $time | Time to run the job (null for as soon as possible). |
string | $interval | String that is understood by PHP's strtotime() to reschedule the job after it is finished. |
- Returns
- \Rsi\Fred\Worker\Job
Definition at line 50 of file Worker.php.
◆ delete()
Delete a scheduled job from the queue.
- Parameters
-
- Returns
- bool True when successful.
Definition at line 38 of file Worker.php.
◆ execute()
Execute the worker / process the scheduled jobs.
Call his function as often as possible.
- Parameters
-
string | $id | Specific job ID to execute (whether scheduled time has come or not). |
Definition at line 114 of file Worker.php.
◆ instant()
instant |
( |
|
$class_name, |
|
|
|
$config = null |
|
) |
| |
Run a job instantly.
- Parameters
-
string | $class_name | Class name for the job. |
array | $config | Configuration options (key-value pairs) for the job. |
Definition at line 58 of file Worker.php.
◆ lock()
Lock a job.
- Parameters
-
\\Rsi\\Fred\\Worker\\Job | $job | Job to lock. |
- Returns
- bool True if the job has been locked.
Definition at line 74 of file Worker.php.
◆ next()
Next scheduled job to execute.
- Parameters
-
string | $id | Specific job ID to execute (whether scheduled time has come or not). |
- Returns
- \Rsi\Fred\Worker\Job (empty if there is no job to be executed).
Definition at line 66 of file Worker.php.
◆ overdue()
Overdue jobs.
Jobs that have been locked longer than twice their interval or the default overdue interval.
- Returns
- array Of \Rsi\Fred\Worker\Job items.
Definition at line 106 of file Worker.php.
◆ ready()
Mark a job as done.
- Parameters
-
\\Rsi\\Fred\\Worker\\Job | $job | Job. |
Definition at line 98 of file Worker.php.
◆ reschedule()
reschedule |
( |
|
$job, |
|
|
|
$time = null |
|
) |
| |
|
protected |
Reschedule a job.
- Parameters
-
\\Rsi\\Fred\\Worker\\Job | $job | Job to reschedule. |
int | $time | Time to reschedule at (null for as soon as possible). |
- Returns
- bool True if the job has been rescheduled.
Definition at line 91 of file Worker.php.
◆ schedule()
schedule |
( |
|
$class_name, |
|
|
|
$config = null , |
|
|
|
$time = null , |
|
|
|
$interval = null |
|
) |
| |
Add a job to the queue.
- Parameters
-
string | $class_name | Class name for the job. |
array | $config | Configuration options (key-value pairs) for the job. |
int | $time | Time to run the job (null for as soon as possible). |
string | $interval | String that is understood by PHP's strtotime() to reschedule the job after it is finished. |
- Returns
- string Job ID when successful.
Definition at line 30 of file Worker.php.
◆ transClassName()
transClassName |
( |
|
$class_name | ) |
|
|
protected |
Translate a job class name.
- Parameters
-
string | $class_name | Class name for the job, or an alias. |
- Returns
- string Class name.
Definition at line 19 of file Worker.php.
◆ unlock()
Unlock a job.
- Parameters
-
\\Rsi\\Fred\\Worker\\Job | $job | Job to unlock. |
- Returns
- bool True if the job has been unlocked.
Definition at line 82 of file Worker.php.
◆ $breakCount
Halt the processig of job after this amount (even when there are more jobs scheduled).
Definition at line 9 of file Worker.php.
◆ $breakTime
Halt the processig of job after this time (seconds; even when there are more jobs scheduled).
Definition at line 10 of file Worker.php.
◆ $classNameAlias
Job class name aliasses (key = alias, value = class name).
Definition at line 7 of file Worker.php.
◆ $defaultOverduePeriod
$defaultOverduePeriod = '+1 hour' |
Default overdue period for jobs that do not have a rescheduling interval.
Definition at line 11 of file Worker.php.
◆ $logTimerPrio
Log the begin and end times of a job with this (custom) prio.
Definition at line 12 of file Worker.php.
◆ $timeLimit
Default time limit for a job (seconds).
Definition at line 8 of file Worker.php.
The documentation for this class was generated from the following file:
- /var/www/fred.local/vendor/rsi/fred/src/Rsi/Fred/Worker.php