private function getAllSegments() { if (!$this->segmentListCache->contains('all')) { $segments = $this->segmentEditorModel->getAllSegmentsAndIgnoreVisibility(); $this->segmentListCache->save('all', $segments); } return $this->segmentListCache->fetch('all'); }
public function getLocation($userInfo, $useClassCache = true) { $userInfoKey = md5(implode(',', $userInfo)); if ($useClassCache && $this->locationCache->contains($userInfoKey)) { return $this->locationCache->fetch($userInfoKey); } $location = $this->getLocationObject($this->provider, $userInfo); if (empty($location)) { $providerId = $this->provider->getId(); Common::printDebug("GEO: couldn't find a location with Geo Module '{$providerId}'"); if ($providerId != $this->backupProvider->getId()) { Common::printDebug("Using default provider as fallback..."); $location = $this->getLocationObject($this->backupProvider, $userInfo); } } $location = $location ?: array(); if (empty($location['country_code'])) { $location['country_code'] = Visit::UNKNOWN_CODE; } $this->locationCache->save($userInfoKey, $location); return $location; }
private function getSiteIdsThatAreRequestedInThisArchiveButWereNotInvalidatedYet() { if (is_null(self::$cache)) { self::$cache = Cache::getTransientCache(); } $id = 'Archive.SiteIdsOfRememberedReportsInvalidated'; if (!self::$cache->contains($id)) { self::$cache->save($id, array()); } $siteIdsAlreadyHandled = self::$cache->fetch($id); $siteIdsRequested = $this->params->getIdSites(); foreach ($siteIdsRequested as $index => $siteIdRequested) { $siteIdRequested = (int) $siteIdRequested; if (in_array($siteIdRequested, $siteIdsAlreadyHandled)) { unset($siteIdsRequested[$index]); // was already handled previously, do not do it again } else { $siteIdsAlreadyHandled[] = $siteIdRequested; // we will handle this id this time } } self::$cache->save($id, $siteIdsAlreadyHandled); return $siteIdsRequested; }