MutexInterface
interface MutexInterface (View source)
Represent a class that can offer a mutually-exclusive system that allows, for instance, to be sure to run some code just once even in concurrent situations.
Methods
Acquire a mutex given its key.
Release a mutex given its key.
Execute a callable by acquiring and releasing a mutex, so that the callable won't be executed by multiple processes concurrently.
Details
static bool
isSupported(Application $app)
Is this mutex available for the current system?
acquire(string $key)
Acquire a mutex given its key.
If the mutex is already acquired (for example by another process), a.
release(string $key)
Release a mutex given its key.
If the mutex not already acquired nothing happens. When the current PHP process ends, the mutex will be released automatically.
execute(string $key, callable $callback)
Execute a callable by acquiring and releasing a mutex, so that the callable won't be executed by multiple processes concurrently.