achertovsky/yii2-semaphore-mutex

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (dev-master) of this package.

Implementation of semaphore mutex

dev-master 2021-09-29 04:49 UTC

This package is auto-updated.

Last update: 2022-05-29 01:55:48 UTC


README

Description

Implementation of mutex through semaphore. Good for providing atomic access

Installing

The preferred way to install this extension is through composer.

{
	"require": {
	    "achertovsky/yii2-semaphore-mutex": "@dev"
    }
}

or

	composer require achertovsky/yii2-semaphore-mutex "@dev"

Usage

Add to components

[
    'components' => [
        'mutex' => [
            'class' => 'yii\mutex\FileMutex'
        ],
    ],
]

Use by

$name = 'test mutex';
//use null to wait infinite or amount of seconds to wait in second param
Yii::$app->mutex->acquire($name, $infiniteWait ? null : 15);
Yii::$app->mutex->release($name);