class
Illuminate
/
Redis
/
Limiters
/
DurationLimiterBuilder
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
public
$sleep int
The number of milliseconds to wait between attempts to acquire the lock.
Default: 750
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
sleep ( $sleep ) : $this
The number of milliseconds to wait between lock acquisition attempts.
Parameters
- $sleep 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