1 | <?php |
||
36 | class MysqlMutex extends DbMutex |
||
37 | { |
||
38 | /** |
||
39 | * Initializes MySQL specific mutex component implementation. |
||
40 | * @throws InvalidConfigException if [[db]] is not MySQL connection. |
||
41 | */ |
||
42 | 10 | public function init() |
|
49 | |||
50 | /** |
||
51 | * Acquires lock by given name. |
||
52 | * @param string $name of the lock to be acquired. |
||
53 | * @param int $timeout time (in seconds) to wait for lock to become released. |
||
54 | * @return bool acquiring result. |
||
55 | * @see http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_get-lock |
||
56 | */ |
||
57 | 10 | protected function acquireLock($name, $timeout = 0) |
|
67 | |||
68 | /** |
||
69 | * Releases lock by given name. |
||
70 | * @param string $name of the lock to be released. |
||
71 | * @return bool release result. |
||
72 | * @see http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_release-lock |
||
73 | */ |
||
74 | protected function releaseLock($name) |
||
84 | |||
85 | /** |
||
86 | * Generate hash for lock name to avoid exceeding lock name length limit. |
||
87 | * |
||
88 | * @param string $name |
||
89 | * @return string |
||
90 | * @since 2.0.16 |
||
91 | * @see https://github.com/yiisoft/yii2/pull/16836 |
||
92 | */ |
||
93 | 10 | protected function hashLockName($name) { |
|
96 | } |
||
97 |