interface RefreshableLease implements Lease

A lease that supports refreshing its TTL and inspecting remaining lifetime.

Semantics mirror RefreshableLock: refresh() is atomic and owner-checked, refresh(null) re-applies the duration the slot was acquired with as the backend interpreted it, and an explicit non-positive TTL throws.

Methods

bool
release()

Release the held slot if still owned by this lease.

from  Lease
string
owner()

Get the owner identifier of this lease.

from  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

in Lease at line 20
bool release()

Release the held slot if still owned by this lease.

Return Value

bool

in Lease at line 25
string owner()

Get the owner identifier of this lease.

Return Value

string

at line 26
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 33
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