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

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.

Namespace

Google \ Cloud \ Core \ Lock

Methods

__construct

Parameters
Name Description
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
Name Description
options array

Configuration options.

↳ blocking bool

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

Returns
Type Description
bool

release

Releases the lock.

Constants

FILE_PATH_TEMPLATE

Value: '%s/%s.lock'

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年12月06日 UTC.