Retrieve routes by site key
public fetchBySiteKey ( string $siteKey ) : |
||
$siteKey | string | site key |
return |
/** * Retrieve routes by site key * * @param string $siteKey site key * @return InstanceRoute[] */ public function fetchBySiteKey($siteKey) { if (!isset($this->mapBySiteKey[$siteKey])) { $routes = $this->repo->fetchBySiteKey($siteKey); foreach ($routes as $route) { $this->setToMap($route); } } return $this->mapBySiteKey[$siteKey]; }
/** * Retrieve routes by site key * * @param string $siteKey site key * @return InstanceRoute[] */ public function fetchBySiteKey($siteKey) { $key = $this->getCacheKey($siteKey); $routes = $this->cache->has($key) ? $this->cache->get($key) : call_user_func(function () use($siteKey, $key) { $routes = $this->repo->fetchBySiteKey($siteKey); if (count($routes) > 0) { $this->cache->put($key, $routes); } return $routes; }); return $routes; }