W3cubDocs

/Laravel 8

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.

Parameters

DateTimeInterface|DateInterval|int $delay

Return Value

int

protected int availableAt(DateTimeInterface|DateInterval|int $delay = 0)

Get the "available at" UNIX timestamp.

Parameters

DateTimeInterface|DateInterval|int $delay

Return Value

int

protected DateTimeInterface|int parseDateInterval(DateTimeInterface|DateInterval|int $delay)

If the given value is an interval, convert it to a DateTime instance.

Parameters

DateTimeInterface|DateInterval|int $delay

Return Value

DateTimeInterface|int

protected int currentTime()

Get the current system time as a UNIX timestamp.

Return Value

int

void __construct(string $key = '', DateTimeInterface|int|null $releaseAfter = 0, DateTimeInterface|int $expiresAfter = 0)

Create a new middleware instance.

Parameters

string $key
DateTimeInterface|int|null $releaseAfter
DateTimeInterface|int $expiresAfter

Return Value

void

mixed handle(mixed $job, callable $next)

Process the job.

Parameters

mixed $job
callable $next

Return Value

mixed

$this releaseAfter(int $releaseAfter)

Set the delay (in seconds) to release the job back to the queue.

Parameters

int $releaseAfter

Return Value

$this

$this dontRelease()

Do not release the job back to the queue if no lock can be acquired.

Return Value

$this

$this expireAfter(DateTimeInterface|int $expiresAfter)

Set the maximum number of seconds that can elapse before the lock is released.

Parameters

DateTimeInterface|int $expiresAfter

Return Value

$this

$this withPrefix(string $prefix)

Set the prefix of the lock key.

Parameters

string $prefix

Return Value

$this

string getLockKey(mixed $job)

Get the lock key for the given job.

Parameters

mixed $job

Return Value

string

© 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