本文整理匯總了PHP中Bitrix\Main\Data\Cache::shouldClearCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP Cache::shouldClearCache方法的具體用法?PHP Cache::shouldClearCache怎麽用?PHP Cache::shouldClearCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Bitrix\Main\Data\Cache
的用法示例。
在下文中一共展示了Cache::shouldClearCache方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: read
/**
* @param bool $isArray
* @return null
*/
protected function read($isArray = false)
{
$value = $isArray ? array() : null;
if (!$this->beenWrite && \Bitrix\Main\Data\Cache::shouldClearCache()) {
$this->clear();
}
$this->timeLive && $this->original->read($value, $this->baseDir(), $this->bxInitDir, $this->key, $this->timeLive);
return $value;
}
示例2: onEpilogComposite
private static function onEpilogComposite()
{
global $USER, $APPLICATION;
if (is_object($USER) && $USER->IsAuthorized())
{
if (self::isCurrentUserCC())
{
if ($APPLICATION->get_cookie("CC") !== "Y" || $APPLICATION->get_cookie("NCC") === "Y")
{
self::setCC();
}
}
else
{
if ($APPLICATION->get_cookie("NCC") !== "Y" || $APPLICATION->get_cookie("CC") === "Y")
{
self::setNCC();
}
}
}
else
{
if ($APPLICATION->get_cookie("NCC") === "Y" || $APPLICATION->get_cookie("CC") === "Y")
{
self::deleteCompositeCookies();
}
}
if (Main\Data\Cache::shouldClearCache())
{
$server = Main\Context::getCurrent()->getServer();
$queryString = DeleteParam(array("clear_cache", "clear_cache_session"));
$uri = new Bitrix\Main\Web\Uri($server->getRequestUri());
$refinedUri = $queryString != "" ? $uri->getPath()."?".$queryString : $uri->getPath();
$cachedFile = self::convertUriToPath($refinedUri, self::getHttpHost());
$cacheStorage = Bitrix\Main\Data\StaticHtmlCache::getStaticHtmlStorage($cachedFile);
if ($cacheStorage !== null)
{
$bytes = $cacheStorage->delete();
if ($bytes !== false && $cacheStorage->shouldCountQuota())
{
self::updateQuota(-$bytes);
}
}
}
}