class ConcurrencyLease implements RefreshableLease

A held slot in a Redis funnel limiter.

The owner id is stored and compared raw, never packed: the slot value is written by the acquire Lua script, compared raw by release/refresh scripts, and read raw during permanent-slot ownership checks. RedisLock writes through set(), so its owner must be packed before Lua comparisons; funnel leases do not.

Methods

__construct(RedisProxy $redis, string $key, string $owner, int $releaseAfter)

Create a new lease instance.

bool
release()

Release the held slot if still owned by this lease.

string
owner()

Get the owner identifier of this lease.

bool
refresh(int|null $seconds = null)

Refresh the lease's TTL if still owned by this lease.

float|null
getRemainingLifetime()

Get the number of seconds until the lease expires.

Details

at line 26
__construct(RedisProxy $redis, string $key, string $owner, int $releaseAfter)

Create a new lease instance.

Parameters

RedisProxy $redis
string $key
string $owner
int $releaseAfter

at line 37
bool release()

Release the held slot if still owned by this lease.

Return Value

bool

at line 45
string owner()

Get the owner identifier of this lease.

Return Value

string

at line 55
bool refresh(int|null $seconds = null)

Refresh the lease's TTL if still owned by this lease.

Parameters

int|null $seconds

Seconds to set the TTL to (null = re-apply the acquisition TTL)

Return Value

bool

True if the lease was refreshed (or is permanent and still owned), false if not owned or expired

Exceptions

InvalidArgumentException

at line 75
float|null getRemainingLifetime()

Get the number of seconds until the lease expires.

Return Value

float|null

Seconds remaining, or null if the slot doesn't exist or has no expiry