tsfcorp/mysql-lock

Provides a locking mechanism using mysql

v0.0.3 2019-11-18 14:31 UTC

This package is auto-updated.

Last update: 2024-11-07 17:52:56 UTC


README

Installation

Require this package in your composer.json and update composer. Run the following command:

composer require tsfcorp/mysql-lock

After updating composer, the service provider will automatically be registered and enabled, along with the facade, using Auto-Discovery

Usage Instructions

MysqlLock library can be used when you don't want two processes to overlap

if ( ! MysqlLock::get($lock_name))
{
    // a lock already exists. Please try again later
}

Make sure that at the end of your script to always release the lock:

MysqlLock::release($lock_name);