interface Lock (View source)

Methods

mixed
get(callable|null $callback = null)

Attempt to acquire the lock.

mixed
block(int $seconds, callable|null $callback = null)

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

bool
release()

Release the lock.

string
owner()

Returns the current owner of the lock.

bool
isLocked()

Determine if the lock is currently held by any process.

void
forceRelease()

Releases this lock in disregard of ownership.

Details

mixed get(callable|null $callback = null)

Attempt to acquire the lock.

Parameters

callable|null $callback

Return Value

mixed

mixed block(int $seconds, callable|null $callback = null)

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

Parameters

int $seconds
callable|null $callback

Return Value

mixed

Exceptions

LockTimeoutException

bool release()

Release the lock.

Return Value

bool

string owner()

Returns the current owner of the lock.

Return Value

string

bool isLocked()

Determine if the lock is currently held by any process.

Return Value

bool

void forceRelease()

Releases this lock in disregard of ownership.

Return Value

void