Skip to content

Centralised blocking or non-blocking locks using MySQL's InnoDB transaction features.

License

Notifications You must be signed in to change notification settings

bigstepinc/php-lock-mysql-innodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Centralized locking with InnoDB

Centralised blocking or non-blocking locks using MySQL's InnoDB transaction features.

Requirements

  • PHP >= 7.2.0

Installation

If you are using composer, run the following command in the root directory of your project.

composer require bigstep/lock-mysql-innodb

Usage

You will need a config with the following MySQL parameters:

$array = [
    "databaseName" => "databaseName",
    "port" => 3306,
    "host" => "localhost",
    "username" => "username",
    "password" => "password"
];

Then you can instantiate the MySQL InnoDB Driver and start acquiring locks.

$client = new LockInnoDB\Engines\MySQLInnoDB\Driver(/*\LockInnoDB\Engines\DriverBase*/ null, $array);

$client->acquire("Lock1", true);
$client->release("Lock1");

About

Centralised blocking or non-blocking locks using MySQL's InnoDB transaction features.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published