8
8
use NinjaMutex \Lock \FlockLock ;
9
9
use NinjaMutex \Lock \LockAbstract ;
10
10
use NinjaMutex \Lock \MemcachedLock ;
11
- use NinjaMutex \Lock \MySqlLock ;
11
+ use NinjaMutex \Lock \MySQLPDOLock ;
12
12
use NinjaMutex \Lock \PhpRedisLock ;
13
13
use NinjaMutex \Lock \PredisRedisLock ;
14
14
use NinjaMutex \Mutex as NinjaMutex ;
@@ -38,7 +38,7 @@ class Mutex
38
38
*/
39
39
public function __construct (Command $ command )
40
40
{
41
- /** @var WithoutOverlapping $command */
41
+ /** @var Command| WithoutOverlapping $command */
42
42
$ this ->command = $ command ;
43
43
44
44
$ mutexName = $ command ->getMutexName ();
@@ -58,11 +58,14 @@ public function getNinjaMutexLock(): LockAbstract
58
58
$ strategy = $ this ->command ->getMutexStrategy ();
59
59
switch ($ strategy ) {
60
60
case 'mysql ' :
61
- return new MySqlLock (
61
+ return new MySQLPDOLock (
62
+ 'mysql: ' . implode ('; ' , [
63
+ 'host= ' . config ('database.connections.mysql.host ' ),
64
+ 'port= ' . config ('database.connections.mysql.port ' , 3306 ),
65
+ ]),
62
66
config ('database.connections.mysql.username ' ),
63
67
config ('database.connections.mysql.password ' ),
64
- config ('database.connections.mysql.host ' ),
65
- config ('database.connections.mysql.port ' , 3306 )
68
+ config ('database.connections.mysql.options ' ),
66
69
);
67
70
68
71
case 'redis ' :
0 commit comments