LockMySQL
class LockMySQL (View source)
Methods for acquiring and releasing application-level locks when using the MySQL database
Properties
Methods
Get the name of the lock to use specific to the database name of the current application, as a SQL-escaped string.
Sets a lock so that no two processes can run at the same time.
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)
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.
static
isFreeToLock($lockName = '')
Checks if the another process is already running:
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)
run($request)
No description