class Illuminate / Redis / Limiters / DurationLimiterBuilder
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

DurationLimiterBuilder

Uses

Properties

public

$connection Connection

The Redis connection.

Default: null
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

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

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