class
Illuminate
/
Redis
/
Limiters
/
ConcurrencyLimiter
You are viewing an older version of the documentation. For the latest, please visit master documentation.
ConcurrencyLimiter
Properties
protected
$name string
The name of the limiter.
Default: null
protected
$maxLocks int
The allowed number of concurrent tasks.
Default: null
protected
$releaseAfter int
The number of seconds a slot should be maintained.
Default: null
Methods
public
__construct ( $redis , $name , $maxLocks , $releaseAfter ) : void
Create a new concurrency limiter instance.
Parameters
- $redis Connection
- $name string
- $maxLocks int
- $releaseAfter int
public
block ( $timeout , $callback ) : bool
Attempt to acquire the lock for the given number of seconds.
Parameters
- $timeout int
- $callback callable|null
protected
acquire ( $id ) : mixed
Attempt to acquire the lock.
Parameters
-
$id
string
A unique identifier for this lock
protected
lockScript ( ) : string
Get the Lua script for acquiring a lock.
protected
release ( $key , $id ) : void
Release the lock.
Parameters
- $key string
- $id string
protected
releaseScript ( ) : string
Get the Lua script to atomically release a lock.