PHP Class yii\mutex\MysqlMutex

Application configuration example: [ 'components' => [ 'db' => [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=127.0.0.1;dbname=demo', ] 'mutex' => [ 'class' => 'yii\mutex\MysqlMutex', ], ], ]
See also: Mutex
Since: 2.0
Author: resurtm ([email protected])
Inheritance: extends yii\mutex\DbMutex
Show file Open project: yiisoft/yii2

Public Methods

Method Description
init ( ) Initializes MySQL specific mutex component implementation.

Protected Methods

Method Description
acquireLock ( string $name, integer $timeout ) : boolean Acquires lock by given name.
releaseLock ( string $name ) : boolean Releases lock by given name.

Method Details

acquireLock() protected method

Acquires lock by given name.
See also: http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_get-lock
protected acquireLock ( string $name, integer $timeout ) : boolean
$name string of the lock to be acquired.
$timeout integer to wait for lock to become released.
return boolean acquiring result.

init() public method

Initializes MySQL specific mutex component implementation.
public init ( )

releaseLock() protected method

Releases lock by given name.
See also: http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_release-lock
protected releaseLock ( string $name ) : boolean
$name string of the lock to be released.
return boolean release result.