Esempio n. 1
0
 function endDataCache($vars = false)
 {
     if (!$this->isStarted) {
         return;
     }
     $this->isStarted = false;
     $arAllVars = array("CONTENT" => ob_get_contents(), "VARS" => $vars !== false ? $vars : $this->vars);
     $this->cacheEngine->write($arAllVars, $this->baseDir, $this->initDir, $this->filename, $this->TTL);
     if (static::$showCacheStat) {
         $written = 0;
         $path = '';
         if ($this->cacheEngine instanceof ICacheEngineStat) {
             $written = $this->cacheEngine->getWrittenBytes();
             $path = $this->cacheEngine->getCachePath();
         } elseif ($this->cacheEngine instanceof \ICacheBackend) {
             /** @noinspection PhpUndefinedFieldInspection */
             $written = $this->cacheEngine->written;
             /** @noinspection PhpUndefinedFieldInspection */
             $path = $this->cacheEngine->path;
         }
         Diag\CacheTracker::addCacheStatBytes($written);
         Diag\CacheTracker::add($written, $path, $this->baseDir, $this->initDir, $this->filename, "W");
     }
     if (strlen(ob_get_contents()) > 0) {
         ob_end_flush();
     } else {
         ob_end_clean();
     }
 }
Esempio n. 2
0
 /**
  * Saves the result of calculation to the cache.
  *
  * @param mixed $vars
  * @return void
  */
 function EndDataCache($vars = false)
 {
     if (!$this->bStarted) {
         return;
     }
     $this->bStarted = false;
     $arAllVars = array("CONTENT" => ob_get_contents(), "VARS" => $vars !== false ? $vars : $this->vars);
     $this->_cache->write($arAllVars, $this->basedir, $this->initdir, $this->filename, $this->TTL);
     $GLOBALS["CACHE_STAT_BYTES"] += $this->_cache->written;
     if (strlen(ob_get_contents()) > 0) {
         ob_end_flush();
     } else {
         ob_end_clean();
     }
 }