interface LockManagerInterface (View source)

Defines exclusive callback execution keyed by a lock-file path.

Methods

mixed
lock(string $file, callable $callback)

Executes the given callback while holding an exclusive file lock.

mixed

Details

lock

mixed lock(string $file, callable $callback)

Executes the given callback while holding an exclusive file lock.

The lock file directory is created automatically if it does not exist. The lock is released after the callback finishes. A callback failure remains the primary failure if releasing the lock also fails.

Parameters

string $file
callable $callback

Return Value

mixed

Exceptions

FilesystemException