public function refreshCache() { /* Check if we need to check for updates */ $currenttime = time(); if ($this->_last_update + $this->_max_change_age > $currenttime) { return; } $params = array("userIp" => $this->processor->userip, "maxResults" => 500, "includeDeleted" => true, "includeSubscribed" => true); if ($this->getLastCacheId() === '') { $params['maxResults'] = 1; } else { $params['startChangeId'] = (string) ((int) $this->getLastCacheId() + 1); } $changes = $this->processor->getChanges($params); if ($changes !== false) { if ($this->getLastCacheId() === '') { $this->setLastCacheId($changes->getLargestChangeId()); $this->setLastUpdate(); } else { $this->processChanges($changes); $pageToken = $changes->getNextPageToken(); if ($pageToken) { $this->refreshCache(); } if (count($changes->getItems()) === 0) { $this->setLastCacheId($changes->getLargestChangeId()); $this->setLastUpdate(); } } } }