Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel jobs

use IlluminateSupportFacadesRedis;

/**
 * Execute the job.
 *
 * @return void
 */
public function handle()
{
    Redis::throttle('key')->block(0)->allow(1)->every(5)->then(function () {
        info('Lock obtained...');

        // Handle job...
    }, function () {
        // Could not obtain lock...

        return $this->release(5);
    });
}
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #laravel #jobs
ADD COMMENT
Topic
Name
8+8 =