code: public function beforeRun($event)
      {
          $cacheKey = $this->getCacheKey();
          $fragmentCacheConfiguration = $this->getFragmentCacheConfiguration();
  
          if (!$this->owner->view->beginCache($cacheKey, $fragmentCacheConfiguration)) {
              $event->isValid = false;
          }
      }
docs: Begins fragment caching. Prevents owner widget from execution
  if its contents can be retrieved from the cache.
  
  @param WidgetEvent $event `Widget::EVENT_BEFORE_RUN` event.