alex / mutexlock
MutexLock makes sure that a cron job defined in multiple identical web servers will not execute more than one task at a time. Backed by Redis.
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 2 525
Dependents: 0
Suggesters: 0
Security: 0
Stars: 15
Watchers: 1
Forks: 2
Open Issues: 0
Requires
- php: >=5.4
- colinmollenhour/credis: ~1.2
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2020-08-07 17:53:32 UTC
README
MutexLock makes sure that a cron job defined in multiple identical web servers will not execute more than one task at a time. Backed by Redis.
sample usage
use Monolog\Logger; use Monolog\Handler\SyslogHandler; use Monolog\Formatter\LineFormatter; $log = new Logger('cron'); $syslog = new SyslogHandler('webapp'); $formatter = new LineFormatter("%channel%.%level_name%: %message%"); $syslog->setFormatter($formatter); $log->pushHandler($syslog); MutexLock\Lock::init([ 'logger' => $log, 'host' => '127.0.0.1', 'port' => '6379', ]); if (!MutexLock\Lock::set(LOCK_KEY, LOCK_TIME)) { return; }
License
MIT