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. |
|
| protected string|null | $storeName | The cache store that should hold the lock. |
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 may be shared across jobs belonging to different classes.
Specify the cache store that should hold the lock.
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 47
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 63
protected int
currentTime()
Get the current system time as a UNIX timestamp.
in
InteractsWithTime at line 71
protected string
runTimeForHumans(float $startTime, float|null $endTime = null)
Given a start time, format the total run time for human readability.
at line 54
__construct(UnitEnum|int|string $key = '', DateTimeInterface|int|null $releaseAfter = 0, DateTimeInterface|int $expiresAfter = 0)
Create a new middleware instance.
at line 66
mixed
handle(mixed $job, callable $next)
Process the job.
at line 91
WithoutOverlapping
releaseAfter(DateTimeInterface|int $releaseAfter)
Set the delay (in seconds) to release the job back to the queue.
at line 103
WithoutOverlapping
dontRelease()
Do not release the job back to the queue if no lock can be acquired.
at line 115
WithoutOverlapping
expireAfter(DateInterval|DateTimeInterface|int $expiresAfter)
Set the maximum number of seconds that can elapse before the lock is released.
at line 127
WithoutOverlapping
withPrefix(string $prefix)
Set the prefix of the lock key.
at line 139
WithoutOverlapping
shared()
Indicate that the lock key may be shared across jobs belonging to different classes.
at line 151
WithoutOverlapping
store(UnitEnum|string $store)
Specify the cache store that should hold the lock.
at line 161
string
getLockKey(mixed $job)
Get the lock key for the given job.