original_string: protected function lookup(Request $request, $catch = false)
      {
          try {
              $entry = $this->store->lookup($request);
          } catch (\Exception $e) {
              $this->record($request, 'lookup-failed');
  
              if ($this->options['debug']) {
                  throw $e;
              }
  
              return $this->pass($request, $catch);
          }
  
          if (null === $entry) {
              $this->record($request, 'miss');
  
              return $this->fetch($request, $catch);
          }
  
          if (!$this->isFreshEnough($request, $entry)) {
              $this->record($request, 'stale');
  
              return $this->validate($request, $entry, $catch);
          }
  
          $this->record($request, 'fresh');
  
          $entry->headers->set('Age', $entry->getAge());
  
          return $entry;
      }
code: protected function lookup(Request $request, $catch = false)
      {
          try {
              $entry = $this->store->lookup($request);
          } catch (\Exception $e) {
              $this->record($request, 'lookup-failed');
  
              if ($this->options['debug']) {
                  throw $e;
              }
  
              return $this->pass($request, $catch);
          }
  
          if (null === $entry) {
              $this->record($request, 'miss');
  
              return $this->fetch($request, $catch);
          }
  
          if (!$this->isFreshEnough($request, $entry)) {
              $this->record($request, 'stale');
  
              return $this->validate($request, $entry, $catch);
          }
  
          $this->record($request, 'fresh');
  
          $entry->headers->set('Age', $entry->getAge());
  
          return $entry;
      }
code_tokens: protected function lookup ( Request $ request , $ catch = false ) { try { $ entry = $ this -> store -> lookup ( $ request ) ; } catch ( \ Exception $ e ) { $ this -> record ( $ request , 'lookup-failed' ) ; if ( $ this -> options [ 'debug' ] ) { throw $ e ; } return $ this -> pass ( $ request , $ catch ) ; } if ( null === $ entry ) { $ this -> record ( $ request , 'miss' ) ; return $ this -> fetch ( $ request , $ catch ) ; } if ( ! $ this -> isFreshEnough ( $ request , $ entry ) ) { $ this -> record ( $ request , 'stale' ) ; return $ this -> validate ( $ request , $ entry , $ catch ) ; } $ this -> record ( $ request , 'fresh' ) ; $ entry -> headers -> set ( 'Age' , $ entry -> getAge ( ) ) ; return $ entry ; }
docstring: Lookups a Response from the cache for the given Request.
  
  When a matching cache entry is found and is fresh, it uses it as the
  response without forwarding any request to the backend. When a matching
  cache entry is found but is stale, it attempts to "validate" the entry with
  the backend using conditional GET. When no matching cache entry is found,
  it triggers "miss" processing.
  
  @param Request $request A Request instance
  @param bool    $catch   Whether to process exceptions
  
  @return Response A Response instance
  
  @throws \Exception
docstring_tokens: Lookups a Response from the cache for the given Request .