Created
April 21, 2017 11:09
-
-
Save s2ar/befdf5212aca72bd246aaefde29c8234 to your computer and use it in GitHub Desktop.
Чистка кеша
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Очистка кеша | |
* @param array $iblockIds - id инфоблоков | |
*/ | |
function ClearCache($iblockIds = array()) | |
{ | |
CModule::IncludeModule('iblock'); | |
// >= iblock 15.0.7 | |
if (method_exists('CIBlock', 'clearIblockTagCache')) { | |
CIBlock::enableClearTagCache(); | |
if(is_array($iblockIds)){ | |
foreach ($iblockIds as $iblockId) { | |
CIBlock::clearIblockTagCache($iblockId); | |
} | |
} | |
CIBlock::DisableClearTagCache(); | |
} else { | |
BXClearCache(true); | |
(new \Bitrix\Main\Data\ManagedCache())->cleanAll(); | |
(new \CStackCacheManager())->CleanAll(); | |
} | |
if ( | |
method_exists('CHTMLPagesCache', 'IsCompositeEnabled') | |
&& CHTMLPagesCache::IsCompositeEnabled() | |
) { | |
CHTMLPagesCache::CleanAll(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment