class LockMySQL (View source)

Methods for acquiring and releasing application-level locks when using the MySQL database

Properties

Methods

protected static 
lockNamePostfix()

Get the name of the lock to use specific to the database name of the current application, as a SQL-escaped string.

public static 
getLock($lockName = '', $secondsToTry = 5)

Sets a lock so that no two processes can run at the same time.

public static 
isFreeToLock($lockName = '')

Checks if the another process is already running:

public static 
releaseLock($lockName = '')

Remove the lock file to allow another process to run (if the execution aborts (e.g. due to an error) all locks are automatically released)

public
run($request)

No description

Details

static protected lockNamePostfix()

Get the name of the lock to use specific to the database name of the current application, as a SQL-escaped string.

static getLock($lockName = '', $secondsToTry = 5)

Sets a lock so that no two processes can run at the same time.

Return false = 0 if acquiring the lock fails; otherwise return true, if lock was acquired successfully. Lock is automatically released if connection to the database is broken (either normally or abnormally). Waits for the lock to free up for $secondsToTry seconds.

Parameters

$lockName
$secondsToTry

static isFreeToLock($lockName = '')

Checks if the another process is already running:

Parameters

$lockName

static releaseLock($lockName = '')

Remove the lock file to allow another process to run (if the execution aborts (e.g. due to an error) all locks are automatically released)

Parameters

$lockName

run($request)

No description

Parameters

$request