class Illuminate / Redis / Limiters / ConcurrencyLimiterBuilder
You are viewing an older version of the documentation. For the latest, please visit master documentation.

ConcurrencyLimiterBuilder

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 entities that can hold the lock at the same time.

Default: null
public

$releaseAfter int

The number of seconds to maintain the lock until it is automatically released.

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

public

limit ( $maxLocks ) : $this

Set the maximum number of locks that can be obtained per time window.

Parameters

  • $maxLocks int
public

releaseAfter ( $releaseAfter ) : $this

Set the number of seconds until the lock will be released.

Parameters

  • $releaseAfter 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