code: protected function validateCache($lastModified, $etag)
      {
          if (Yii::$app->request->headers->has('If-None-Match')) {
              // HTTP_IF_NONE_MATCH takes precedence over HTTP_IF_MODIFIED_SINCE
              // http://tools.ietf.org/html/rfc7232#section-3.3
              return $etag !== null && in_array($etag, Yii::$app->request->getETags(), true);
          } elseif (Yii::$app->request->headers->has('If-Modified-Since')) {
              return $lastModified !== null && @strtotime(Yii::$app->request->headers->get('If-Modified-Since')) >= $lastModified;
          }
  
          return false;
      }
docs: Validates if the HTTP cache contains valid content.
  If both Last-Modified and ETag are null, returns false.
  @param int $lastModified the calculated Last-Modified value in terms of a UNIX timestamp.
  If null, the Last-Modified header will not be validated.
  @param string $etag the calculated ETag value. If null, the ETag header will not be validated.
  @return bool whether the HTTP cache is still valid.