class RateLimited (View source)

Properties

protected RateLimiter $limiter

The rate limiter instance.

protected string $limiterName

The name of the rate limiter.

bool $shouldRelease

Indicates if the job should be released if the limit is exceeded.

Methods

void
__construct(BackedEnum|UnitEnum|string $limiterName)

Create a new middleware instance.

mixed
handle(mixed $job, callable $next)

Process the job.

mixed
handleJob(mixed $job, callable $next, array $limits)

Handle a rate limited job.

$this
dontRelease()

Do not release the job back to the queue if the limit is exceeded.

int
getTimeUntilNextRetry(string $key)

Get the number of seconds that should elapse before the job is retried.

array
__sleep()

Prepare the object for serialization.

void
__wakeup()

Prepare the object after unserialization.

Details

void __construct(BackedEnum|UnitEnum|string $limiterName)

Create a new middleware instance.

Parameters

BackedEnum|UnitEnum|string $limiterName

Return Value

void

mixed handle(mixed $job, callable $next)

Process the job.

Parameters

mixed $job
callable $next

Return Value

mixed

protected mixed handleJob(mixed $job, callable $next, array $limits)

Handle a rate limited job.

Parameters

mixed $job
callable $next
array $limits

Return Value

mixed

$this dontRelease()

Do not release the job back to the queue if the limit is exceeded.

Return Value

$this

protected int getTimeUntilNextRetry(string $key)

Get the number of seconds that should elapse before the job is retried.

Parameters

string $key

Return Value

int

array __sleep()

Prepare the object for serialization.

Return Value

array

void __wakeup()

Prepare the object after unserialization.

Return Value

void

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.