Pimcore\Cache::clearTagsOnShutdown PHP Method

clearTagsOnShutdown() public static method

Clears all tags stored in self::$_clearTagsOnShutdown, this function is executed in \Pimcore::shutdown()
public static clearTagsOnShutdown ( ) : void
return void
    public static function clearTagsOnShutdown()
    {
        // do not disable clearing, it's better purging items here than having inconsistent data because of wrong usage
        /*if (!self::$enabled) {
              Logger::debug("Cache is not cleared because it is disabled");
              return;
          }*/
        if (!empty(self::$_clearTagsOnShutdown)) {
            $tags = array_unique(self::$_clearTagsOnShutdown);
            if ($cache = self::getInstance()) {
                $cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, $tags);
            }
        }
    }

Usage Example

Beispiel #1
0
 /**
  * this method is called with register_shutdown_function() and writes all data queued into the cache
  * @static
  * @return void
  */
 public static function shutdown()
 {
     // set inShutdown to true so that the output-buffer knows that he is allowed to send the headers
     self::$inShutdown = true;
     // flush all custom output buffers
     while (@ob_end_flush()) {
     }
     // flush everything
     flush();
     if (function_exists("fastcgi_finish_request")) {
         fastcgi_finish_request();
     }
     // clear tags scheduled for the shutdown
     Cache::clearTagsOnShutdown();
     // write collected items to cache backend and remove the write lock
     Cache::write();
     Cache::removeWriteLock();
     // release all open locks from this process
     Model\Tool\Lock::releaseAll();
     // disable logging - otherwise this will cause problems in the ongoing shutdown process (session write, __destruct(), ...)
     \Logger::resetLoggers();
 }