本文整理匯總了PHP中Pimcore\Model\Cache::addClearedTag方法的典型用法代碼示例。如果您正苦於以下問題:PHP Cache::addClearedTag方法的具體用法?PHP Cache::addClearedTag怎麽用?PHP Cache::addClearedTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pimcore\Model\Cache
的用法示例。
在下文中一共展示了Cache::addClearedTag方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: dispatchLoopShutdown
/**
*
*/
public function dispatchLoopShutdown()
{
if ($this->enabled && session_id()) {
$this->disable("session in use");
}
if ($this->disableReason) {
$this->getResponse()->setHeader("X-Pimcore-Output-Cache-Disable-Reason", $this->disableReason, true);
}
if ($this->enabled && $this->getResponse()->getHttpResponseCode() == 200) {
try {
if ($this->lifetime && $this->addExpireHeader) {
// add cache control for proxies and http-caches like varnish, ...
$this->getResponse()->setHeader("Cache-Control", "public, max-age=" . $this->lifetime, true);
// add expire header
$this->getResponse()->setHeader("Expires", \Zend_Date::now()->add($this->lifetime)->get(\Zend_Date::RFC_1123), true);
}
$cacheItem = array("headers" => $this->getResponse()->getHeaders(), "rawHeaders" => $this->getResponse()->getRawHeaders(), "content" => $this->getResponse()->getBody(), "date" => \Zend_Date::now()->getIso());
$cacheKey = $this->defaultCacheKey;
$deviceDetector = Tool\DeviceDetector::getInstance();
if ($deviceDetector->wasUsed()) {
$cacheKey .= "_" . $deviceDetector->getDevice();
}
CacheManager::save($cacheItem, $cacheKey, array("output"), $this->lifetime, 1000);
} catch (\Exception $e) {
\Logger::error($e);
return;
}
} else {
// output-cache was disabled, add "output" as cleared tag to ensure that no other "output" tagged elements
// like the inc and snippet cache get into the cache
CacheManager::addClearedTag("output_inline");
}
}