Elgg
Version master
|
Provides database mutex that can be used to prevent race conditions between two processes that affect the same data. More...
Public Member Functions | |
__construct (protected Database $db) | |
Constructor. More... | |
lock (string $namespace) | |
Creates a table {prefix}{$namespace}_lock that is used as a mutex. More... | |
unlock (string $namespace) | |
Unlocks mutex. More... | |
isLocked (string $namespace) | |
Checks if mutex is locked. More... | |
Protected Member Functions | |
assertNamespace (string $namespace) | |
Assert that the namespace contains only characters [A-Za-z]. More... | |
Provides database mutex that can be used to prevent race conditions between two processes that affect the same data.
NOTE: This class uses the database connections directly because the queries aren't QueryBuilders
Elgg\Database\Mutex::__construct | ( | protected Database | $db | ) |
|
protected |
Elgg\Database\Mutex::isLocked | ( | string | $namespace | ) |
Elgg\Database\Mutex::lock | ( | string | $namespace | ) |
Elgg\Database\Mutex::unlock | ( | string | $namespace | ) |