/** * TempestCache::tempestChanged($incoming) to check if incoming data array matches cache * * @param array[] $incoming Array structure of current dataset that needs to be compared to the cache. * * @return boolean True if datasets are different or timestamp is not within in the hour. Cache resets every hour. * returns false if incoming data set is the same as cache. */ static function tempestChanged($incoming) { if (NULL == self::$instance) { self::$instance = new TempestCache(); if (!file_exists(self::$tempest)) { self::setCache($incoming); return true; } else { $fp = fopen(self::$tempest, 'r'); self::$cache = json_decode(fgets($fp)); fclose($fp); } } //Write cache and return true when current cache is empty or timestamp are different hour or incoming data set is different than cache if (empty(self::$cache) || !self::checkTimeStamp($incoming) || !self::checkDataSet($incoming)) { self::setCache($incoming); return true; } return false; }