class Illuminate / Redis / Limiters / DurationLimiter

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 , $sleep ) : mixed

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

Parameters

  • $timeout int
  • $callback callable|null
  • $sleep int
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.