tokenly/laravel-record-lock
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
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
644,549,754
9,698
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
423,477,751
607
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
403,217,078
4,664
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| v1.2.0 | >=5.5.0 | MIT | |
| v1.1.0 | >=5.5.0 | MIT | |
| v1.0.0 | >=5.5.0 | MIT |