Static Public Member Functions | |
| static | priorityString ($numericPriority) |
| Gives a human-readable string desccription for a numeric priority value. | |
| static | registerTask ($callback, $interval, $priority=self::PRIORITY_DEFAULT) |
| Registers a cron task. | |
| static | tick (spunQ_IMutex $mutex=NULL) |
| Processes all tasks in order of priority. | |
Public Attributes | |
| const | PRIORITY_SPUNQ = 1 |
| Reserved priority level for spunQ. | |
| const | PRIORITY_MANDATORY = 2 |
| Priority level for tasks that must be done as soon as possible. | |
| const | PRIORITY_IMPORTANT = 4 |
| Priority level for tasks that should be done quickly. | |
| const | PRIORITY_DEFAULT = 6 |
| Default priority level. | |
| const | PRIORITY_UNIMPORTANT = 8 |
| Priority level for tasks that don't have to complete. | |
| const | PRIORITY_NEGLIGABLE = 10 |
| Priority level for the most unimportant tasks. | |
Static Protected Member Functions | |
| static | taskIsDue ($previousTimestamp, $currentTimestamp, $interval) |
| Checks if a task needs to be performed. | |
Static Protected Attributes | |
| static | $tasks = array() |
| The tasks that have been registered via registerTask(). | |
The priorities for the tasks determine the order in which they are processed. More important ones come first, so that any errors generated in other processes don't bother them.
Definition at line 9 of file Cron.class.php.
| static spunQ_Cron::priorityString | ( | $ | numericPriority | ) | [static] |
Gives a human-readable string desccription for a numeric priority value.
| $numericPriority | A numeric priority value. |
Definition at line 62 of file Cron.class.php.
| static spunQ_Cron::registerTask | ( | $ | callback, | |
| $ | interval, | |||
| $ | priority = self::PRIORITY_DEFAULT | |||
| ) | [static] |
Registers a cron task.
| $interval | Time interval in seconds that this task needs to be executed in. | |
| $priority | Either of the PRIORITY_* constants. | |
| $callback | A callback to execute when this task needs to be performed. |
Definition at line 87 of file Cron.class.php.
| static spunQ_Cron::taskIsDue | ( | $ | previousTimestamp, | |
| $ | currentTimestamp, | |||
| $ | interval | |||
| ) | [static, protected] |
Checks if a task needs to be performed.
Every task is considered due at timestamps divisible by their interval.
| $previousTimestamp | Timestamp when tick() was last invoked. | |
| $currentTimestamp | Value returned by time(). Kept as argument to maintain atomicity. | |
| interval | The interval of the task. |
Definition at line 150 of file Cron.class.php.
| static spunQ_Cron::tick | ( | spunQ_IMutex $ | mutex = NULL |
) | [static] |
Processes all tasks in order of priority.
Definition at line 102 of file Cron.class.php.
spunQ_Cron::$tasks = array() [static, protected] |
The tasks that have been registered via registerTask().
This is a nested array containing priorities as keys at the outer-most level, intervals after that, which then contain the tasks. So a task with priority x and an update interval of y can be found in the array $tasks[x][y].
Definition at line 55 of file Cron.class.php.
| const spunQ_Cron::PRIORITY_DEFAULT = 6 |
Default priority level.
See class documentation for more information on priorities.
Definition at line 33 of file Cron.class.php.
| const spunQ_Cron::PRIORITY_IMPORTANT = 4 |
Priority level for tasks that should be done quickly.
See class documentation for more information on priorities.
Definition at line 27 of file Cron.class.php.
| const spunQ_Cron::PRIORITY_MANDATORY = 2 |
Priority level for tasks that must be done as soon as possible.
See class documentation for more information on priorities.
Definition at line 21 of file Cron.class.php.
| const spunQ_Cron::PRIORITY_NEGLIGABLE = 10 |
Priority level for the most unimportant tasks.
See class documentation for more information on priorities.
Definition at line 45 of file Cron.class.php.
| const spunQ_Cron::PRIORITY_SPUNQ = 1 |
Reserved priority level for spunQ.
See class documentation for more information on priorities.
Definition at line 15 of file Cron.class.php.
| const spunQ_Cron::PRIORITY_UNIMPORTANT = 8 |
Priority level for tasks that don't have to complete.
See class documentation for more information on priorities.
Definition at line 39 of file Cron.class.php.
1.5.9