Google Cloud PHP shared dependency, providing functionality useful to all components. Client - Class FlockLock (1.50.0)

Reference documentation and code samples for the Google Cloud PHP shared dependency, providing functionality useful to all components. Client class FlockLock.

Flock based lock implementation.

Methods

__construct

Parameters
NameDescription
fileName string

The name of the file to use as a lock.

options array

Configuration options.

↳ exclusive bool

If true, acquire an excluse (write) lock. If false, acquire a shared (read) lock. Defaults to true.

acquire

Acquires a lock that will block until released.

Parameters
NameDescription
options array

Configuration options.

↳ blocking bool

Whether the process should block while waiting to acquire the lock. Defaults to true.

Returns
TypeDescription
bool

release

Releases the lock.

Constants

FILE_PATH_TEMPLATE

Value: '%s/%s.lock'