Persist
in package
Uses
UtilsProvider
Persist new elements to the queue.
Table of Contents
Constants
- TABLE_NAME = 'p_queue'
Properties
- $core : mixed
- $group_uuid : mixed
- $jobs : array<string|int, Job>
- Persistable jobs.
Methods
- __construct() : mixed
- C'tor.
- addJob() : mixed
- Add a new job. You can pass multiple jobs, but do not forget to `commit` your jobs so they get persisted to the database!
- clearJobTable() : mixed
- Clear the queue / job database table. Cause we do not want to get a messy database.
- commit() : mixed
- Write the jobs to the database.
- deleteByType() : mixed
- Delete jobs by type. This is similar to "Cancel".
- getPluginConstantPrefix() : string
- Get the prefix of this package so we can utils package natively.
- retryByType() : mixed
- Retry jobs by type.
- setupConstants() : mixed
- Make sure the REAL_QUEUE constants are available.
- skipByType() : mixed
- Skip jobs by type.
- startGroup() : string
- Start a group for the next added items. This can help you to keep track of "bundled" jobs. Please consider to `stopGroup`, too!
- startTransaction() : mixed
- Start the persist mechanism.
- stopGroup() : mixed
- Stop the group.
- fillGroupTotal() : mixed
- Fill `group_total`. Why is this not calculated in our database? Our database is self-cleaning because all done jobs are automatically erased after some time (e.g. each 100 records).
Constants
TABLE_NAME
public
mixed
TABLE_NAME
= 'p_queue'
Properties
$core
private
mixed
$core
$group_uuid
private
mixed
$group_uuid
$jobs
Persistable jobs.
private
array<string|int, Job>
$jobs
= []
Methods
__construct()
C'tor.
public
__construct(Core $core) : mixed
Parameters
- $core : Core
Tags
addJob()
Add a new job. You can pass multiple jobs, but do not forget to `commit` your jobs so they get persisted to the database!
public
addJob(Job $job) : mixed
Parameters
- $job : Job
clearJobTable()
Clear the queue / job database table. Cause we do not want to get a messy database.
public
clearJobTable() : mixed
If you want to keep statistics, do this in your job callback and persist data to your own database table.
commit()
Write the jobs to the database.
public
commit() : mixed
deleteByType()
Delete jobs by type. This is similar to "Cancel".
public
deleteByType(string $type) : mixed
Parameters
- $type : string
getPluginConstantPrefix()
Get the prefix of this package so we can utils package natively.
public
getPluginConstantPrefix() : string
Return values
stringretryByType()
Retry jobs by type.
public
retryByType(string $type) : mixed
Parameters
- $type : string
setupConstants()
Make sure the REAL_QUEUE constants are available.
public
static setupConstants() : mixed
skipByType()
Skip jobs by type.
public
skipByType(string $type) : mixed
Parameters
- $type : string
startGroup()
Start a group for the next added items. This can help you to keep track of "bundled" jobs. Please consider to `stopGroup`, too!
public
startGroup() : string
Return values
string —The used UUID for this group, you do not have to manually set the group_id
in your upcoming models!
startTransaction()
Start the persist mechanism.
public
startTransaction() : mixed
stopGroup()
Stop the group.
public
stopGroup() : mixed
fillGroupTotal()
Fill `group_total`. Why is this not calculated in our database? Our database is self-cleaning because all done jobs are automatically erased after some time (e.g. each 100 records).
protected
fillGroupTotal() : mixed