Neos\Flow\Mvc\Routing\RouterCachingService::storeMatchResults PHP Метод

storeMatchResults() публичный Метод

Stores the $matchResults in the cache
public storeMatchResults ( Request $httpRequest, array $matchResults ) : void
$httpRequest Neos\Flow\Http\Request
$matchResults array
Результат void
    public function storeMatchResults(Request $httpRequest, array $matchResults)
    {
        if ($this->containsObject($matchResults)) {
            return;
        }
        $tags = $this->generateRouteTags($httpRequest->getRelativePath(), $matchResults);
        $this->routeCache->set($this->buildRouteCacheIdentifier($httpRequest), $matchResults, $tags);
    }

Usage Example

Пример #1
0
 /**
  * Iterates through all configured routes and calls matches() on them.
  * Returns the matchResults of the matching route or NULL if no matching
  * route could be found.
  *
  * @param Request $httpRequest The web request to be analyzed. Will be modified by the router.
  * @return array The results of the matching route or NULL if no route matched
  */
 public function route(Request $httpRequest)
 {
     $cachedMatchResults = $this->routerCachingService->getCachedMatchResults($httpRequest);
     if ($cachedMatchResults !== false) {
         return $cachedMatchResults;
     }
     $this->lastMatchedRoute = null;
     $this->createRoutesFromConfiguration();
     /** @var $route Route */
     foreach ($this->routes as $route) {
         if ($route->matches($httpRequest) === true) {
             $this->lastMatchedRoute = $route;
             $matchResults = $route->getMatchResults();
             if ($matchResults !== null) {
                 $this->routerCachingService->storeMatchResults($httpRequest, $matchResults);
             }
             $this->systemLogger->log(sprintf('Router route(): Route "%s" matched the path "%s".', $route->getName(), $httpRequest->getRelativePath()), LOG_DEBUG);
             return $matchResults;
         }
     }
     $this->systemLogger->log(sprintf('Router route(): No route matched the route path "%s".', $httpRequest->getRelativePath()), LOG_NOTICE);
     return null;
 }
All Usage Examples Of Neos\Flow\Mvc\Routing\RouterCachingService::storeMatchResults