Esempio n. 1
0
 /**
  * Method is executed as one of the last one in the whole Pimcore.
  * Saves a full static page if request is eligible to cache.
  */
 public function dispatchLoopShutdown()
 {
     $this->checkRequest($this->_request);
     $body = $this->getResponse()->getBody();
     $type = $body[0] === '{' ? CacheElement::TYPE_JAVASCRIPT : CacheElement::TYPE_HTML;
     if ($this->isEnabled()) {
         $this->checkExcludedPatterns($this->_request->getRequestUri());
         $this->checkCookies();
     }
     if (!$this->ignored && $this->getResponse()->getHttpResponseCode() == 200) {
         $cacheManager = new CacheManager($this->finder);
         $cacheElement = new CacheElement($this->_request->getRequestUri(), $body, $type);
         $cacheElement->setRawPath($this->_request->getRequestUri());
         $cacheManager->saveElement($cacheElement);
     }
 }