class LockManager

Class LockManager

Methods

create(string $name)

No description

acquire(string $name, int|NULL $timeout = NULL)

Create and attempt to acquire a lock.

callable|NULL
getFactory(string $name)

No description

register(string $pattern, string|array $factory)

Register the lock-factory to use for specific lock-names.

Details

at line 52
LockInterface create(string $name)

Parameters

string $name Symbolic name for the lock. Names generally look like "worker.mailing.EmailProcessor" ("{category}.{component}.{AdhocName}").

Categories: worker|data|cache|... Component: core|mailing|member|contribute|...

Return Value

LockInterface

Exceptions

CRM_Core_Exception

at line 82
LockInterface acquire(string $name, int|NULL $timeout = NULL)

Create and attempt to acquire a lock.

Note: Be sure to check $lock->isAcquired() to determine whether acquisition was successful.

Parameters

string $name Symbolic name for the lock. Names generally look like "worker.mailing.EmailProcessor" ("{category}.{component}.{AdhocName}").

Categories: worker|data|cache|... Component: core|mailing|member|contribute|...

int|NULL $timeout The number of seconds to wait to get the lock. For a default value, use NULL.

Return Value

LockInterface

Exceptions

CRM_Core_Exception

at line 93
callable|NULL getFactory(string $name)

Parameters

string $name Symbolic name for the lock.

Return Value

callable|NULL

at line 113
LockManager register(string $pattern, string|array $factory)

Register the lock-factory to use for specific lock-names.

Parameters

string $pattern A regex to match against the lock name.
string|array $factory A callback. The callback should accept a $name parameter. Callbacks will be located using the resolver.

Return Value

LockManager

See also

Resolver