ConcurrencyLimiter
class ConcurrencyLimiter
Properties
| protected list<string> | $slots | Precomputed slot names. Built once in the constructor. |
Methods
__construct(LockProvider $store, string $name, int $maxLocks, int $releaseAfter)
Create a new concurrency limiter instance.
acquire(int $timeout, int $sleep = 250)
Acquire a lease on one of the limiter's slots, waiting up to the given timeout.
mixed
block(int $timeout, callable|null $callback = null, int $sleep = 250)
Attempt to acquire the lock for the given number of seconds.
Details
at line 35
__construct(LockProvider $store, string $name, int $maxLocks, int $releaseAfter)
Create a new concurrency limiter instance.
at line 51
Lease
acquire(int $timeout, int $sleep = 250)
Acquire a lease on one of the limiter's slots, waiting up to the given timeout.
at line 84
mixed
block(int $timeout, callable|null $callback = null, int $sleep = 250)
Attempt to acquire the lock for the given number of seconds.
When no callback is given, the slot is reserved fire-and-forget: it is held until the releaseAfter TTL reclaims it. Use acquire() to obtain a releasable lease instead.
at line 112
protected false|Lock
claimSlot(string $id)
Attempt to acquire a slot lock.