code: public function getModifiedResponse(Request $request, $params = [], $lifetime = -1, Response $response = null)
      {
          $response = $this->getResponse($params, $lifetime, $response);
  
          if ($response->isNotModified($request)) {
              throw new NotModifiedException($response);
          }
  
          return $response;
      }
docs: Get only modified response.
  
  Throw exception if response was not modified for this request
  
  Set $lifetime as < 0 for not set max-age
  
  @throws NotModifiedException
  
  @param Request $request
  @param mixed $params
  @param int $lifetime
  @param Response|null $response
  
  @return Response