Last active
May 28, 2019 13:23
-
-
Save geff21st/9721caa0b8bd62290e9ac8d5e33e3ec7 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
<? | |
$arData = array(); | |
$cacheId = "cache_id/{$id}"; | |
$cacheDir = $cacheId; | |
$cacheTag = "iblock_id_{$iblock}"; | |
$cacheTime = 360000; | |
$cache = \Bitrix\Main\Data\Cache::createInstance(); | |
if ($cache->initCache($cacheTime, $cacheId, $cacheDir)) { | |
$arData = $cache->getVars(); | |
} elseif ($cache->startDataCache()) { | |
$cacheManager = Bitrix\Main\Application::getInstance()->getTaggedCache(); | |
$cacheManager->startTagCache($cacheDir); | |
// get result | |
$cacheManager->registerTag($cacheTag); | |
$cacheManager->registerTag("iblock_new"); | |
$cacheManager->endTagCache(); | |
$cache->endDataCache($arData); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment