PHP code example of tokenly / laravel-record-lock
1. Go to this page and download the library: Download tokenly/laravel-record-lock library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tokenly / laravel-record-lock example snippets
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;
});