本文整理汇总了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");
}
}