tokenly/laravel-record-lock

A locking library
16,750 2
Install
composer require tokenly/laravel-record-lock
Latest Version:v1.2.0
PHP:>=5.5.0
License:MIT
Last Updated:Dec 3, 2019
Links: GitHub  ·  Packagist
Maintainer: dweller

Record Lock

A Laravel library for creating a shared lock across an application. Requires a MySQL database connection.

Installation

Add the Laravel package via composer

composer require tokenly/laravel-record-lock

Add the Service Provider (Laravel <= 5.4 only)

Add the following to the providers array in your application config:

Tokenly\RecordLock\Provider\RecordLockServiceProvider::class

Use it


use Tokenly\RecordLock\Facade\RecordLock;

$lock_id = 'plant-garden-once';
$planted = RecordLock::acquireAndExecute($lock_id, function() {
    // plant the garden
    //   only one process should do this at a time
    //   other processes will block until this is complete
    sleep(1);

    return true;
});

Related Packages

erirk/paypalpayment

laravel-paypalpayment is simple package help you process direct credit card paym...

0
gabrieloliverio/laravel5-generators

Database metadata-based generators for Laravel 5

1
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

617,346,630 9,703
laravel/framework

The Laravel Framework.

558,184,770 34,846
laravel/tinker

Powerful REPL for the Laravel framework.

468,807,761 7,441