Skip to content

Instantly share code, notes, and snippets.

@s2ar
Created April 21, 2017 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s2ar/befdf5212aca72bd246aaefde29c8234 to your computer and use it in GitHub Desktop.
Save s2ar/befdf5212aca72bd246aaefde29c8234 to your computer and use it in GitHub Desktop.
Чистка кеша
<?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