fetchBySiteKey() public method

Retrieve routes by site key
public fetchBySiteKey ( string $siteKey ) : InstanceRoute[]
$siteKey string site key
return InstanceRoute[]
Exemplo n.º 1
0
 /**
  * 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];
 }
Exemplo n.º 2
0
 /**
  * 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;
 }