Answer the question
In order to leave comments, you need to log in
Caching when using api - how?
For example,
require_once($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/include/prolog_before.php");
$arSelect = Array("ID", "IBLOCK_ID", "NAME", "DATE_ACTIVE_FROM","PROPERTY_*");//IBLOCK_ID и ID обязательно должны быть указаны, см. описание arSelectFields выше
$arFilter = Array("IBLOCK_ID"=>IntVal($yvalue), "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y");
$res = CIBlockElement::GetList(Array(), $arFilter, false, Array("nPageSize"=>50), $arSelect);
while($ob = $res->GetNextElement()){
$arFields = $ob->GetFields();
print_r($arFields);
$arProps = $ob->GetProperties();
print_r($arProps);
}
Answer the question
In order to leave comments, you need to log in
CPhpCache - a class from the old API for caching PHP variables and HTML script results. See examples on the documentation page.
In D7, the analogue is \Bitrix\Main\Data\Cache
use \Bitrix\Main\Data\Cache;
$cache = Cache::createInstance(); // получаем экземпляр класса
if ($cache->initCache(7200, "cache_key")) { // проверяем кеш и задаём настройки
$vars = $cache->getVars(); // достаем переменные из кеша
}
elseif ($cache->startDataCache()) {
// некоторые действия...
$cache->endDataCache(array("key" => "value")); // записываем в кеш
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question