Elgg  Version 2.3
Public Member Functions | List of all members
Elgg\Database\Mutex Class Reference

WARNING: API IN FLUX. More...

Public Member Functions

 __construct (\Elgg\Database $db,\Elgg\Logger $logger)
 Constructor. More...
 
 lock ($namespace)
 Creates a table {prefix}{$namespace}_lock that is used as a mutex. More...
 
 unlock ($namespace)
 Unlocks mutex. More...
 
 isLocked ($namespace)
 Checks if mutex is locked. More...
 

Detailed Description

WARNING: API IN FLUX.

DO NOT USE DIRECTLY.

Provides database mutex that can be used to prevent race conditions between two processes that affect the same data.

private

Since
2.1.0

Definition at line 14 of file Mutex.php.

Constructor & Destructor Documentation

Elgg\Database\Mutex::__construct ( \Elgg\Database  $db,
\Elgg\Logger  $logger 
)

Constructor.

Parameters
\Elgg\Database$dbDatabase
\Elgg\Logger$loggerLogger

Definition at line 32 of file Mutex.php.

Member Function Documentation

Elgg\Database\Mutex::isLocked (   $namespace)

Checks if mutex is locked.

Parameters
string$namespaceNamespace to use for the database table
Returns
bool

Definition at line 76 of file Mutex.php.

Elgg\Database\Mutex::lock (   $namespace)

Creates a table {prefix}{$namespace}_lock that is used as a mutex.

Parameters
string$namespaceAllows having separate locks for separate processes
Returns
bool

Definition at line 43 of file Mutex.php.

Elgg\Database\Mutex::unlock (   $namespace)

Unlocks mutex.

Parameters
string$namespaceNamespace to use for the database table
Returns
void

Definition at line 63 of file Mutex.php.


The documentation for this class was generated from the following file: