WithoutOverlapping
class WithoutOverlapping
Traits
Properties
| string | $key | The job's unique key used for preventing overlaps. |
|
| int | $expiresAfter | The number of seconds before the lock should expire. |
|
| string | $prefix | The prefix of the lock key. |
|
| bool | $shareKey | Share the key across different jobs. |
Methods
Get the number of seconds until the given DateTime.
Get the "available at" UNIX timestamp.
If the given value is an interval, convert it to a DateTime instance.
Given a start time, format the total run time for human readability.
Create a new middleware instance.
Process the job.
Set the delay (in seconds) to release the job back to the queue.
Do not release the job back to the queue if no lock can be acquired.
Set the maximum number of seconds that can elapse before the lock is released.
Set the prefix of the lock key.
Indicate that the lock key should be shared across job classes.
Get the lock key for the given job.
Details
in
InteractsWithTime at line 17
protected int
secondsUntil(DateInterval|DateTimeInterface|int $delay)
Get the number of seconds until the given DateTime.
in
InteractsWithTime at line 29
protected int
availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)
Get the "available at" UNIX timestamp.
in
InteractsWithTime at line 41
protected DateTimeInterface|int
parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)
If the given value is an interval, convert it to a DateTime instance.
in
InteractsWithTime at line 57
protected int
currentTime()
Get the current system time as a UNIX timestamp.
in
InteractsWithTime at line 65
protected string
runTimeForHumans(float $startTime, float|null $endTime = null)
Given a start time, format the total run time for human readability.
at line 49
__construct(UnitEnum|string $key = '', DateTimeInterface|int|null $releaseAfter = 0, DateTimeInterface|int $expiresAfter = 0)
Create a new middleware instance.
at line 61
mixed
handle(mixed $job, callable $next)
Process the job.
at line 88
WithoutOverlapping
releaseAfter(DateTimeInterface|int $releaseAfter)
Set the delay (in seconds) to release the job back to the queue.
at line 98
WithoutOverlapping
dontRelease()
Do not release the job back to the queue if no lock can be acquired.
at line 108
WithoutOverlapping
expireAfter(DateInterval|DateTimeInterface|int $expiresAfter)
Set the maximum number of seconds that can elapse before the lock is released.
at line 118
WithoutOverlapping
withPrefix(string $prefix)
Set the prefix of the lock key.
at line 128
WithoutOverlapping
shared()
Indicate that the lock key should be shared across job classes.
at line 138
string
getLockKey(mixed $job)
Get the lock key for the given job.