Script is very nice, thanks Curly! My question, I don't get much traffic, ~15 unique visitors a day. Would I not be better off to not use a cron or scheduler?
Glad you like it!
Setting up a cron job just speeds things up depending on the total codes you have in the array.
Each location should have at least 2 codes to check for alerts. If you have four locations, that would be a minimum of 8 codes.
Each code entered takes about 2 tenths of a second to check for alerts. If an alert is found, then the alert(s) are downloaded for that code and that takes about 2 tenths of a second per code.
Four tenths of a second doesn't seem that long for each code but that's when conditions are right. When conditions are not right, it could take two to four seconds per code just to check for alerts and then that amount for downloading the alert details. NOW the check and download times are starting to add up per code.
Without a cron, the index page visit makes the script download the data. For one location when conditions are not favorable, the index page wouldn't load for 8 seconds, but that is tolerable.
If you had 4 locations, that could be well over 30 seconds to wait for the page to load. I think that would discourage any visitor.
The purpose of a cron is to have the cache files already on hand so that the index page won't stall out waiting on the downloads if the internet conditions are bad.
In my opinion, if the total amount of codes in the array is four or less, then I would not use a cron. Anything over four should use a cron.