Answer the question
In order to leave comments, you need to log in
Why is the cache not being read from the file, crashes with an error Page not available?
It used to work, but at some point it stopped working.
<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("Продажи");
$MAINUSER = '3';
CModule::IncludeModule('highloadblock');
use Bitrix\Highloadblock\HighloadBlockTable as HLBT;
//Функция получения экземпляра класса:
function GetEntityDataClass($HlBlockId)
{
if (empty($HlBlockId) || $HlBlockId < 1){return false;}
$hlblock = HLBT::getById($HlBlockId)->fetch();
$entity = HLBT::compileEntity($hlblock);
$entity_data_class = $entity->getDataClass();
return $entity_data_class;
};
$arFilter = Array("UF_USER"=>$MAINUSER);
//Запросим продажи
$SalesData = GetEntityDataClass(4)::getList(array(
'select' => array('*'),
'filter' => $arFilter
));
// Кешируем запросы
use \Bitrix\Main\Data\Cache;
$obCache = new CPHPCache();
$cacheLifetime = 600; $cacheID = 'sales'.$MAINUSER; $cachePath = '/'.$cacheID;
if( $obCache->InitCache($cacheLifetime, $cacheID, $cachePath) )
{
$vars = $obCache->GetVars();
extract($vars);
}
elseif( $obCache->StartDataCache() )
{
while($el = $SalesData->fetch()){$sales[] = $el;};
$obCache->EndDataCache(array('sales' => $sales));
};
.......
// Кешируем запросы
use \Bitrix\Main\Data\Cache;
$obCache = new CPHPCache();
$cacheLifetime = 600; $cacheID = 'sales'.$MAINUSER; $cachePath = '/'.$cacheID;
if( $obCache->InitCache($cacheLifetime, $cacheID, $cachePath) )
{
$vars = $obCache->GetVars();
extract($vars);
}
elseif( $obCache->StartDataCache() )
{
while($el = $SalesData->fetch()){$sales[] = $el;};
$obCache->EndDataCache(array('sales' => $sales));
};
// Кешируем запросы
use \Bitrix\Main\Data\Cache;
$obCache = new CPHPCache();
$cacheLifetime = 600; $cacheID = 'sales'.$MAINUSER; $cachePath = '/'.$cacheID;
if( $obCache->StartDataCache() )
{
while($el = $SalesData->fetch()){$sales[] = $el;};
$obCache->EndDataCache(array('sales' => $sales));
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question