PHP Class Yalesov\Cron\Service\Cron

handle cron job registration, validation, scheduling, running, and cleanup
Author: yalesov ([email protected])
Afficher le fichier Open project: heartsentwined/zf2-cron Class Usage Examples

Protected Properties

Свойство Type Description
$em Doctrine\ORM\EntityManager the Doctrine ORM Entity Manager
$failureLogLifetime how long to keep failed (missed / error) cron job logs
$maxRunningTime maximum running time of each cron job
$pending wrapped the Repo function here to implement a (crude) cache feature
$scheduleAhead how long ahead to schedule cron jobs
$scheduleLifetime how long before a scheduled job is considered missed
$successLogLifetime how long to keep successfully completed cron job logs

Méthodes publiques

Méthode Description
cleanLog ( ) : self delete old cron job logs
cleanup ( ) : self perform various cleanup work
getEm ( )
getFailureLogLifetime ( )
getMaxRunningtime ( )
getPending ( )
getScheduleAhead ( )
getScheduleLifeTime ( )
getSuccessLogLifetime ( )
process ( ) : self run cron jobs
recoverRunning ( )
register ( $code, $frequency, $callback, array $args = [] ) wrapper function
resetPending ( )
run ( ) : self main entry function
schedule ( ) : self schedule cron jobs
setEm ( EntityManager $em )
setFailureLogLifetime ( $failureLogLifetime )
setMaxRunningTime ( $maxRunningTime )
setScheduleAhead ( $scheduleAhead )
setScheduleLifetime ( $scheduleLifetime )
setSuccessLogLifetime ( $successLogLifetime )
tryLockJob ( Job $job ) : boolean try to acquire a lock on a cron job

Method Details

cleanLog() public méthode

delete old cron job logs
public cleanLog ( ) : self
Résultat self

cleanup() public méthode

perform various cleanup work
public cleanup ( ) : self
Résultat self

getEm() public méthode

public getEm ( )

getFailureLogLifetime() public méthode

getMaxRunningtime() public méthode

public getMaxRunningtime ( )

getPending() public méthode

public getPending ( )

getScheduleAhead() public méthode

public getScheduleAhead ( )

getScheduleLifeTime() public méthode

public getScheduleLifeTime ( )

getSuccessLogLifetime() public méthode

process() public méthode

run cron jobs
public process ( ) : self
Résultat self

recoverRunning() public méthode

public recoverRunning ( )

register() public static méthode

wrapper function
See also: Registry::register()
public static register ( $code, $frequency, $callback, array $args = [] )
$args array

resetPending() public méthode

public resetPending ( )

run() public méthode

1. schedule new cron jobs 2. process cron jobs 3. cleanup old logs
public run ( ) : self
Résultat self

schedule() public méthode

schedule cron jobs
public schedule ( ) : self
Résultat self

setEm() public méthode

public setEm ( EntityManager $em )
$em Doctrine\ORM\EntityManager

setFailureLogLifetime() public méthode

public setFailureLogLifetime ( $failureLogLifetime )

setMaxRunningTime() public méthode

public setMaxRunningTime ( $maxRunningTime )

setScheduleAhead() public méthode

public setScheduleAhead ( $scheduleAhead )

setScheduleLifetime() public méthode

public setScheduleLifetime ( $scheduleLifetime )

setSuccessLogLifetime() public méthode

public setSuccessLogLifetime ( $successLogLifetime )

tryLockJob() public méthode

set a job to 'running' only if it is currently 'pending'
public tryLockJob ( Job $job ) : boolean
$job Yalesov\Cron\Entity\Job
Résultat boolean

Property Details

$em protected_oe property

the Doctrine ORM Entity Manager
protected EntityManager,Doctrine\ORM $em
Résultat Doctrine\ORM\EntityManager

$failureLogLifetime protected_oe property

how long to keep failed (missed / error) cron job logs
protected $failureLogLifetime

$maxRunningTime protected_oe property

maximum running time of each cron job
protected $maxRunningTime

$pending protected_oe property

wrapped the Repo function here to implement a (crude) cache feature
protected $pending

$scheduleAhead protected_oe property

how long ahead to schedule cron jobs
protected $scheduleAhead

$scheduleLifetime protected_oe property

how long before a scheduled job is considered missed
protected $scheduleLifetime

$successLogLifetime protected_oe property

how long to keep successfully completed cron job logs
protected $successLogLifetime