WithoutOverlapping
class WithoutOverlapping (View source)
Traits
InteractsWithTime |
Properties
string | $key | The job's unique key used for preventing overlaps. | |
DateTimeInterface|int|null | $releaseAfter | The number of seconds before a job should be available again if no lock was acquired. | |
int | $expiresAfter | The number of seconds before the lock should expire. | |
string | $prefix | The prefix of the lock key. |
Methods
int | secondsUntil(DateTimeInterface|DateInterval|int $delay) Get the number of seconds until the given DateTime. | from InteractsWithTime |
int | availableAt(DateTimeInterface|DateInterval|int $delay = 0) Get the "available at" UNIX timestamp. | from InteractsWithTime |
DateTimeInterface|int | parseDateInterval(DateTimeInterface|DateInterval|int $delay) If the given value is an interval, convert it to a DateTime instance. | from InteractsWithTime |
int | currentTime() Get the current system time as a UNIX timestamp. | from InteractsWithTime |
void | __construct(string $key = '', DateTimeInterface|int|null $releaseAfter = 0, DateTimeInterface|int $expiresAfter = 0) Create a new middleware instance. | |
mixed | handle(mixed $job, callable $next) Process the job. | |
$this | releaseAfter(int $releaseAfter) Set the delay (in seconds) to release the job back to the queue. | |
$this | dontRelease() Do not release the job back to the queue if no lock can be acquired. | |
$this | expireAfter(DateTimeInterface|int $expiresAfter) Set the maximum number of seconds that can elapse before the lock is released. | |
$this | withPrefix(string $prefix) Set the prefix of the lock key. | |
string | getLockKey(mixed $job) Get the lock key for the given job. |
Details
protected int secondsUntil(DateTimeInterface|DateInterval|int $delay)
Get the number of seconds until the given DateTime.
protected int availableAt(DateTimeInterface|DateInterval|int $delay = 0)
Get the "available at" UNIX timestamp.
protected DateTimeInterface|int parseDateInterval(DateTimeInterface|DateInterval|int $delay)
If the given value is an interval, convert it to a DateTime instance.
protected int currentTime()
Get the current system time as a UNIX timestamp.
void __construct(string $key = '', DateTimeInterface|int|null $releaseAfter = 0, DateTimeInterface|int $expiresAfter = 0)
Create a new middleware instance.
mixed handle(mixed $job, callable $next)
Process the job.
$this releaseAfter(int $releaseAfter)
Set the delay (in seconds) to release the job back to the queue.
$this dontRelease()
Do not release the job back to the queue if no lock can be acquired.
$this expireAfter(DateTimeInterface|int $expiresAfter)
Set the maximum number of seconds that can elapse before the lock is released.
$this withPrefix(string $prefix)
Set the prefix of the lock key.
string getLockKey(mixed $job)
Get the lock key for the given job.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Queue/Middleware/WithoutOverlapping.html