class
Illuminate
/
Redis
/
Limiters
/
DurationLimiterBuilder
You are viewing an older version of the documentation. For the latest, please visit master documentation.
DurationLimiterBuilder
Uses
Properties
public
$name string
The name of the lock.
Default: null
public
$maxLocks int
The maximum number of locks that can be obtained per time window.
Default: null
public
$decay int
The amount of time the lock window is maintained.
Default: null
public
$timeout int
The amount of time to block until a lock is available.
Default: 3
Methods
public
__construct ( $connection , $name ) : void
Create a new builder instance.
Parameters
- $connection Connection
- $name string
public
allow ( $maxLocks ) : $this
Set the maximum number of locks that can be obtained per time window.
Parameters
- $maxLocks int
public
every ( $decay ) : $this
Set the amount of time the lock window is maintained.
Parameters
- $decay DateTimeInterface |DateInterval |int
public
block ( $timeout ) : $this
Set the amount of time to block until a lock is available.
Parameters
- $timeout int
public
then ( callable $callback , callable $failure ) : mixed
Execute the given callback if a lock is obtained, otherwise call the failure callback.
Parameters
- $callback callable
- $failure callable|null