public function JobSchedulerInterface::set in Job Scheduler 8.2
Same name and namespace in other branches
- 8.3 src/JobSchedulerInterface.php \Drupal\job_scheduler\JobSchedulerInterface::set()
Adds a job to the schedule, replace any existing job.
A job is uniquely identified by $job = array(type, id).
function worker_callback($job) {
// Work off job.
// Set next time to be called. If this portion of the code is not
// reached for some reason, the scheduler will keep periodically invoking
// the callback() with the period value initially specified.
$scheduler
->set($job);
}
Parameters
array $job: An array that must contain the following keys: 'type' - A string identifier of the type of job. 'id' - A numeric identifier of the job. 'period' - The time when the task should be executed. 'periodic' - True if the task should be repeated periodically.
Throws
\Exception Exceptions thrown by code called by this method are passed on.
1 method overrides JobSchedulerInterface::set()
- JobScheduler::set in src/
JobScheduler.php - Adds a job to the schedule, replace any existing job.
File
- src/
JobSchedulerInterface.php, line 51
Class
- JobSchedulerInterface
- Provides an interface defining a job scheduler manager.
Namespace
Drupal\job_schedulerCode
public function set(array $job);