|
| | schedule ($class_name, $config=null, $time=null, $interval=null, $max_time=null) |
| | Add a job to the queue. More...
|
| |
| | delete ($id) |
| | Delete a scheduled job from the queue. More...
|
| |
| | instant ($class_name, $config=null, $timer_id=null) |
| | Run a job instantly. More...
|
| |
| | execute ($id=null) |
| | Execute the worker / process the scheduled jobs. More...
|
| |
| | __construct ($fred, $config=null) |
| |
| | __destruct () |
| |
| | clientConfig () |
| | Public configuration. More...
|
| |
| | config ($key, $default=null) |
| | Retrieve a config value. More...
|
| |
| | ping () |
| | Ping function. More...
|
| |
| | filemtime ($filename) |
| | Filemtime with session cache. More...
|
| |
| | component ($name) |
| | Get a component (local or default). More...
|
| |
| | components (... $names) |
| | Get multiple components in an array. More...
|
| |
| | propertyExists ($property) |
| | Check if a property exists (public or published). More...
|
| |
| | constants ($prefix=null) |
| | Return all constants. More...
|
| |
| | get ($key) |
| | Get one or more properties. More...
|
| |
| | set ($key, $value=null) |
| | Set one or more properties. More...
|
| |
| | __get ($key) |
| |
| | __set ($key, $value) |
| |
|
| | transClassName ($class_name) |
| | Translate a job class name. More...
|
| |
| | create ($class_name, $id, $config=null, $time=null, $interval=null, $max_time=null) |
| | Create a job object. More...
|
| |
| | next ($id=null) |
| | Next scheduled job to execute. More...
|
| |
| | lock ($job) |
| | Lock a job. More...
|
| |
| | unlock ($job) |
| | Unlock a job. More...
|
| |
| | reschedule ($job, $time=null) |
| | Reschedule a job. More...
|
| |
| | ready ($job) |
| | Mark a job as done. More...
|
| |
| | groupCount ($group_id) |
| | Number of active jobs in a group. More...
|
| |
| | checkGroup ($job) |
| | Check if the group (if any) is within its limit. More...
|
| |
| | overdue () |
| | Overdue jobs. More...
|
| |
| | init () |
| |
| | done () |
| |
| | getSession () |
| |
| | publish ($property, $visibility=self::READABLE) |
| | Publish a property (or hide it again). More...
|
| |
| | alias ($alias, $property, $object=null) |
| | Define an alias for a property (of another object). More...
|
| |
| | configure ($config) |
| | Configure the object. More...
|
| |
| | _get ($key) |
| | Default getter if no specific setter is defined, and the property is also not published (readable). More...
|
| |
| | _set ($key, $value) |
| | Default setter if no specific setter is defined, and the property is also not published (writeable). More...
|
| |
Definition at line 5 of file Worker.php.
◆ checkGroup()
Check if the group (if any) is within its limit.
- Parameters
-
| \\Rsi\\Fred\\Worker\\Job | $job | Job. |
- Returns
- bool True when OK.
Definition at line 125 of file Worker.php.
◆ create()
| create |
( |
|
$class_name, |
|
|
|
$id, |
|
|
|
$config = null, |
|
|
|
$time = null, |
|
|
|
$interval = null, |
|
|
|
$max_time = 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. Prefix with an '@' to make it relative to the time of finishing (normally it is relative to the planned time). |
| int | $max_time | Maximum time for executing job (seconds). |
- Returns
- \Rsi\Fred\Worker\Job
Definition at line 60 of file Worker.php.
◆ delete()
Delete a scheduled job from the queue.
- Parameters
-
- Returns
- bool True when successful.
Definition at line 46 of file Worker.php.
◆ execute()
Execute the worker / process the scheduled jobs.
Call his function as often as possible.
- Parameters
-
| string | $id | Only check this job ID. |
Definition at line 141 of file Worker.php.
◆ groupCount()
Number of active jobs in a group.
- Parameters
-
- Returns
- int Number of active (locked) jobs.
Definition at line 117 of file Worker.php.
◆ instant()
| instant |
( |
|
$class_name, |
|
|
|
$config = null, |
|
|
|
$timer_id = null |
|
) |
| |
Run a job instantly.
- Parameters
-
| string | $class_name | Class name for the job. |
| array | $config | Configuration options (key-value pairs) for the job. |
| string | $timer_id | Timer ID for the job to log to. |
Definition at line 69 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 85 of file Worker.php.
◆ next()
Next scheduled job to execute.
- Parameters
-
| string | $id | Only check this job ID. |
- Returns
- \Rsi\Fred\Worker\Job (empty if there is no job to be executed).
Definition at line 77 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 133 of file Worker.php.
◆ ready()
Mark a job as done.
- Parameters
-
| \\Rsi\\Fred\\Worker\\Job | $job | Job. |
Definition at line 109 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 102 of file Worker.php.
◆ schedule()
| schedule |
( |
|
$class_name, |
|
|
|
$config = null, |
|
|
|
$time = null, |
|
|
|
$interval = null, |
|
|
|
$max_time = null |
|
) |
| |
Add a job to the queue.
- Parameters
-
| string | array | $class_name | Class name for the job (or array with group code and class name). |
| 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. Prefix with an '@' to make it relative to the time of finishing (normally it is relative to the planned time). |
| int | $max_time | Maximum time for executing job (seconds). |
- Returns
- string Job ID when successful.
Definition at line 38 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 25 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 93 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 17 of file Worker.php.
◆ $logTimerPrio
Log the begin and end times of a job with this (custom) prio.
Definition at line 18 of file Worker.php.
◆ $maxJobs
Halt the processig of jobs after this amount of jobs processed (even when there are more jobs.
Definition at line 15 of file Worker.php.
◆ $maxTime
Halt the processig of jobs after this time (seconds; even when there are more jobs scheduled).
Definition at line 14 of file Worker.php.
◆ $minTime
Keep processing for at least this amount of time (seconds; even when there are no more jobs.
Definition at line 11 of file Worker.php.
◆ $parallelCommand
Command for executing a single job as a seperate process (asterisk is replaced with job.
Definition at line 8 of file Worker.php.
◆ $sleepTime
Time to sleep when there are no more jobs scheduled (but still within minTime; seconds).
Definition at line 13 of file Worker.php.
◆ $timeLimit
Default time limit for a job (seconds).
Definition at line 10 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