1. Go to this page and download the library: Download olafnorge/console-mutex library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
olafnorge / console-mutex example snippets
use olafnorge\Console\WithoutOverlapping;
class ExampleCommand extends Command
{
use WithoutOverlapping;
// ...
}
class ExampleCommand extends Command
{
use WithoutOverlapping;
protected $mutexStrategy = 'mysql';
// ...
}
class ExampleCommand extends Command
{
use WithoutOverlapping;
public function __construct()
{
parent::__construct();
$this->setMutexStrategy('mysql');
}
// ...
}
class ExampleCommand extends Command
{
use WithoutOverlapping;
protected $mutexTimeout = 3000; // milliseconds
// ...
}
class ExampleCommand extends Command
{
use WithoutOverlapping;
public function __construct()
{
parent::__construct();
$this->setMutexTimeout(3000); // milliseconds
}
// ...
}
class ExampleCommand extends Command
{
use WithoutOverlapping;
public function getMutexName()
{
return "icmutex-for-command1-and-command2";
}
// ...
}