.....
if ($arParams['CACHE_TYPE'] === 'Y' || ($arParams['CACHE_TYPE'] === 'A' && COption::GetOptionString('main', 'component_cache_on', 'Y') === 'Y'))
$arParams['CACHE_TIME'] = intval($arParams['CACHE_TIME']);
else
$arParams['CACHE_TIME'] = 0;
.....
$cache_id = serialize(array($arParams['ELEMENT_ID']));
$cache_path = SITE_ID.'/'.str_replace(':', '/', $this->GetName());
$obCache = new CPHPCache;
if ($obCache->InitCache($arParams['CACHE_TIME'], $cache_id, $cache_path))
{
$vars = $obCache->GetVars();
foreach ($vars as $key => $value)
$arResult[$key] = $value;
$obCache->Output();
}
elseif ($obCache->StartDataCache())
{
..... do something
$obj = CIBlockElement::GetList(false, $arFilter)->GetNextElement();
if ($obj)
{
..... do something
$this->IncludeComponentTemplate();
$obCache->EndDataCache(array(
'ITEM' => $arResult['ITEM'],
'TEMPLATE_FOLDER' => $arResult['TEMPLATE_FOLDER'],
));
}
else
{
@define("ERROR_404", "Y");
CHTTP::SetStatus("404 Not Found");
$obCache->AbortDataCache();
}
}
|