• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/composite/cacheprovider.php
  • Класс: BitrixIntranetCompositeCacheProvider
  • Вызов: CacheProvider::deleteUserCache
static function deleteUserCache($userId = false, $sendHeader = true, $sendPush = true)
{
	global $USER;

	if ($userId === false && is_object($USER) && $USER->IsAuthorized())
	{
		$userId = $USER->GetID();
	}

	$userId = intval($userId);
	if ($userId > 0)
	{
		$postfix = CHTMLPagesCache::getSpaPostfix();
		$privateKey = self::getUserPrefix($userId);
		foreach ($postfix as $item)
		{
			$realPrivateKey = CHTMLPagesCache::getRealPrivateKey($privateKey, $item);
			$staticCache = new StaticHtmlCache("/", null, $realPrivateKey);
			$staticCache->delete();
		}

		if ($sendPush && BitrixMainLoader::includeModule('pull'))
		{
			BitrixPullEvent::add([$userId], [
					'module_id' => 'main',
					'command' => 'composite-cache-up',
					'params' => [],
					'user_params' => [],
					'dictionary' => [],
					'expiry' => 0,
				]
			);
		}

		if ($sendHeader === true)
		{
			$response = BitrixMainContext::getCurrent()->getResponse();
			$response->addHeader("X-Bitrix-Composite-Delete", md5(CHTMLPagesCache::getHttpHost().$privateKey));
		}
	}
}