Answer the question
In order to leave comments, you need to log in
How to correctly call the function with the CPHPCache cache in 1C-Bitrix several times with clear_cache?
Good afternoon,
I cache data from the 1C-Bitrix database using the standard class from the CPHPCache box.
Simple procedural approach.
function myCache()
{
$obCache = new CPHPCache();
$arResult = array();
if($obCache->InitCache(36000000, 'myCache', '/myCache/'))
{
$vars = $obCache->GetVars();
$arResult = $vars['arResult'];
}
elseif($obCache->StartDataCache())
{
/* запросы к бд */
$obCache->EndDataCache(array('arResult' => $arResult));
}
return $arResult;
}
Answer the question
In order to leave comments, you need to log in
You don't seem to understand why the clear_cache variable is in Bitrix. This essentially guarantees that the page will not use the cache. Why bypass it? Of course, you can make your cache and not react to this variable, but then how will you reset it? Create your own custom_clear_cache type variable and what will change except that you will subsequently explain to all developers that you have come up with such a cool bike
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question