SkillAgentSearch skills...

Mutexsafe

MutexSafe will help you use mutex more effectively. Different mutex for different components are presented. In addition, you can add your own lockers and use within the library.

Install / Use

/learn @foxtech6/Mutexsafe
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

MutexSafe

<h3 align="center">Manage locks effectively and faster | With PHP7</h3> <p align="center"> <img width="160" src="mutexsafe.jpg" alt="logo"/> </p>

Latest Stable Version Total Downloads License

  • This library will help you use mutex more effectively.
  • Different mutex for different components are presented.
  • In addition, you can add your own lockers and use within the library.

How to use

$customHandler = new \CustomHandler(/* some parameters */);

// You can send the handler directly to the constructor
$factory = new \Foxtech\Competitor($customHandler);

/* OR */

// via the setHandler method
$factory = new \Foxtech\Competitor();
$factory->setHandler($customHandler);

$timeout = 50;//seconds
$factory->getMutex('mutex_name')->acquire($timeout /* default timeout - 30 seconds */);

// some code

$factory->getMutex('mutex_name')->release();

You can also write your own mutex to a custom handler and use within our library.(Important: Your mutex must implement our interface)

$yourCustomHandler = new YourCustomHandler();

$factory = new \Foxtech\Competitor();
$factory->push(YourCustomHandler::class, YourMutex::class);
$factory->setHandler($yourCustomHandler);

$factory->getMutex('mutex_name')->acquire();

// some code

$factory->getMutex('mutex_name')->release();

PDO Handler

$pdo = new \PDO('mysql:host=localhost;dbname=test', 'root', 'toor');

$factory = new \Foxtech\Competitor($pdo);

$factory->getMutex('mutex_name')->acquire();

// some code

$factory->getMutex('mutex_name')->release();

License

MIT

View on GitHub
GitHub Stars16
CategoryDevelopment
Updated6mo ago
Forks1

Languages

PHP

Security Score

87/100

Audited on Oct 6, 2025

No findings