mixed GetTemplateCachedData();
The GetTemplateCachedData method is called if the standard caching mechanism is not used, but calls to IncludeComponentTemplate are cached. This method returns data that are to be saved in cache, and then restored from cache and returned to the template using SetTemplateCachedData.
// Check and initialize input parameters if ($arParams["ID"] <= 0) $arParams["ID"] = 10; $arParams["CACHE_TIME"] = IntVal($arParams["CACHE_TIME"]); $CACHE_ID = SITE_ID."|".$APPLICATION->GetCurPage()."|"; // cache depends only on the prepared parameters without "~" foreach ($this->arParams as $k => $v) if (strncmp("~", $k, 1)) $CACHE_ID .= ",".$k."=".$v; $CACHE_ID .= "|".$USER->GetGroups(); $cache = new CPageCache; if ($cache->StartDataCache($arParams["CACHE_TIME"], $CACHE_ID, "/".SITE_ID.$this->GetRelativePath())) { // Query data and form the $arResult array $arResult = array("a" => 1, "b" => 2); // Include the component template $this->IncludeComponentTemplate(); $templateCachedData = $this->GetTemplateCachedData(); $cache->EndDataCache( array( "arResult" => $arResult, "templateCachedData" => $templateCachedData ) ); } else { extract($cache->GetVars()); $this->SetTemplateCachedData($templateCachedData); }
© 2001-2007 Bitrix | Bitrix Site Manager |