adhocore / php-cron-expr

Ultra lightweight, Dependency free and Super Fast Cron Expression parser for PHP
https://github.com/adhocore/php-cron-expr
MIT License
50 stars 5 forks source link

bulk due checker #11

Closed adhocore closed 5 years ago

adhocore commented 5 years ago

can it be memorized?

cron has granularity of 1 minute, so a cron deemed due at 9:00:00 am can also be assumed due at 9:00:30 for example

adhocore commented 5 years ago

it would be implemented differently. instead of memoizing it would let testing dues for several expressions at once such that the processing is done only once for one expression:

$jobs = [
  // job name => cron expr
  'name1' => '*/5 * * * *',
  'name2' => '* * * * *',
];

Ahc\Cron\Expression::getDues($jobs, $refTime = time());