- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/general/component.php
- Класс: CBitrixComponent
- Вызов: CBitrixComponent::clearComponentCache
static function clearComponentCache($componentName, $siteId = "")
{
/** @global CCacheManager $CACHE_MANAGER */
global $CACHE_MANAGER;
$componentRelativePath = CComponentEngine::MakeComponentPath($componentName);
if ($componentRelativePath != "")
{
$obCache = new CPHPCache;
$obCache->CleanDir($componentRelativePath, "cache");
BXClearCache(true, $componentRelativePath);
if ($siteId == "")
{
$rsSite = BitrixMainSiteTable::getList(array('order' => array('SORT' => 'ASC')));
while ($site = $rsSite->fetch())
{
$componentCachePath = "/".$site["LID"].$componentRelativePath;
$obCache = new CPHPCache;
$obCache->CleanDir($componentCachePath, "cache");
BXClearCache(true, $componentCachePath);
}
}
else
{
$componentCachePath = "/".$siteId.$componentRelativePath;
$obCache = new CPHPCache;
$obCache->CleanDir($componentCachePath, "cache");
BXClearCache(true, $componentCachePath);
}
if(defined("BX_COMP_MANAGED_CACHE"))
$CACHE_MANAGER->ClearByTag($componentName);
}
}