1use Illuminate\Support\Facades\Redis;
2
3/**
4 * Execute the job.
5 *
6 * @return void
7 */
8public function handle()
9{
10 Redis::throttle('key')->block(0)->allow(1)->every(5)->then(function () {
11 info('Lock obtained...');
12
13 // Handle job...
14 }, function () {
15 // Could not obtain lock...
16
17 return $this->release(5);
18 });
19}