@@ -21,6 +21,8 @@ composer require adhocore/cron-expr
2121
2222## Usage
2323
24+ ** Basic**
25+
2426``` php
2527use Ahc\Cron\Expression;
2628
@@ -34,6 +36,32 @@ $expr = new Expression;
3436$expr->isCronDue('*/1 * * * *', time());
3537```
3638
39+ ** Bulk checks**
40+
41+ When checking for several jobs at once, if more than one of the jobs share equivalent expression
42+ then the evaluation is done only once per go thus greatly improving performnce.
43+
44+ ``` php
45+ use Ahc\Cron\Expression;
46+
47+ $jobs = [
48+ 'job1' => '*/2 */2 * * *',
49+ 'job1' => '* 20,21,22 * * *',
50+ 'job3' => '7-9 * */9 * *',
51+ 'job4' => '*/5 * * * *',
52+ 'job5' => '@5minutes', // equivalent to job4 (so it is due if job4 is due)
53+ 'job6' => '7-9 * */9 * *', // exact same as job3 (so it is due if job3 is due)
54+ ];
55+
56+ // The second param $time can be used same as above: null/time()/date string/DateTime
57+ $dueJobs = Expression::getDues($jobs, '2015-08-10 21:50:00');
58+ // ['job1', 'job4', 'job5']
59+
60+ // Dont like static calls? Below is possible too!
61+ $expr = new Expression;
62+ $dueJobs = $expr->filter($jobs, time());
63+ ```
64+
3765### Real Abbreviations
3866
3967You can use real abbreviations for month and week days. eg: ` JAN ` , ` dec ` , ` fri ` , ` SUN `
0 commit comments