abstract class LockBackendAbstract implements LockBackendInterface (View source)

Non backend related common methods implementation for lock backends.

Properties

protected string $lockId

Current page lock token identifier.

protected array $locks

Existing locks for this page.

Methods

bool
wait(string $name, int $delay = 30)

Waits a short amount of time before a second lock acquire attempt.

string
getLockId()

Gets the unique page token for locks.

Details

bool wait(string $name, int $delay = 30)

Waits a short amount of time before a second lock acquire attempt.

While this method is subject to have a generic implementation in abstract backend implementation, some backends may provide non blocking or less I/O intensive wait mechanism: this is why this method remains on the backend interface.

Parameters

string $name

Lock name currently being locked.

int $delay

Seconds to wait for. Defaults to 30.

Return Value

bool

TRUE if the lock holds, FALSE if it may be available. You still need to acquire the lock manually and it may fail again.

string getLockId()

Gets the unique page token for locks.

Locks will be wiped out at the end of each page request on a token basis.

Return Value

string