DurationLimiterBuilder
class DurationLimiterBuilder (View source)
Traits
InteractsWithTime |
Properties
Connection | $connection | The Redis connection. | |
string | $name | The name of the lock. | |
int | $maxLocks | The maximum number of locks that can obtained per time window. | |
int | $decay | The amount of time the lock window is maintained. | |
int | $timeout | The amount of time to block until a lock is available. |
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(Connection $connection, string $name) Create a new builder instance. | |
$this | allow(int $maxLocks) Set the maximum number of locks that can obtained per time window. | |
$this | every(DateTimeInterface|DateInterval|int $decay) Set the amount of time the lock window is maintained. | |
$this | block(int $timeout) Set the amount of time to block until a lock is available. | |
mixed | then(callable $callback, callable $failure = null) Execute the given callback if a lock is obtained, otherwise call the failure callback. |
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(Connection $connection, string $name)
Create a new builder instance.
$this allow(int $maxLocks)
Set the maximum number of locks that can obtained per time window.
$this every(DateTimeInterface|DateInterval|int $decay)
Set the amount of time the lock window is maintained.
$this block(int $timeout)
Set the amount of time to block until a lock is available.
mixed then(callable $callback, callable $failure = null)
Execute the given callback if a lock is obtained, otherwise call the failure callback.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Redis/Limiters/DurationLimiterBuilder.html