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

DurationLimiter

Properties

private

$redis Connection

The Redis factory implementation.

Default: null
private

$name string

The unique name of the lock.

Default: null
private

$maxLocks int

The allowed number of concurrent tasks.

Default: null
private

$decay int

The number of seconds a slot should be maintained.

Default: null
public

$decaysAt int

The timestamp of the end of the current duration.

Default: null
public

$remaining int

The number of remaining slots.

Default: null

Methods

public

__construct ( $redis , $name , $maxLocks , $decay ) : void

Create a new duration limiter instance.

Parameters

  • $redis Connection
  • $name string
  • $maxLocks int
  • $decay int
public

block ( $timeout , $callback ) : mixed

Attempt to acquire the lock for the given number of seconds.

Parameters

  • $timeout int
  • $callback callable|null
public

acquire ( ) : bool

Attempt to acquire the lock.

public

tooManyAttempts ( ) : bool

Determine if the key has been "accessed" too many times.

public

clear ( ) : void

Clear the limiter.

protected

luaScript ( ) : string

Get the Lua script for acquiring a lock.

protected

tooManyAttemptsLuaScript ( ) : string

Get the Lua script to determine if the key has been "accessed" too many times.