Package Data | |
---|---|
Maintainer Username: | dweller |
Maintainer Contact: | devon@tokenly.com (Devon Weller) |
Package Create Date: | 2015-06-27 |
Package Last Update: | 2019-12-03 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-23 03:13:20 |
Package Statistics | |
---|---|
Total Downloads: | 14,898 |
Monthly Downloads: | 95 |
Daily Downloads: | 4 |
Total Stars: | 2 |
Total Watchers: | 5 |
Total Forks: | 0 |
Total Open Issues: | 0 |
A Laravel library for creating a shared lock across an application. Requires a MySQL database connection.
composer require tokenly/laravel-record-lock
Add the following to the providers
array in your application config:
Tokenly\RecordLock\Provider\RecordLockServiceProvider::class
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;
});