Answer the question
In order to leave comments, you need to log in
How to bypass composite caching in Bitrix?
Greetings.
In the product card, I determine the city by the user's ip.
To defeat caching, I implemented this code in component_epilog.php.
But still, the foreign city is cached. After the second reload of the page, the city rises as needed.
I'm assuming that's how composite mode caches?
How to bypass it so that the code is executed completely bypassing the cache?
AddEventHandler('main', 'OnEndBufferContent', 'SetDeleveryInfo');
...
$City = $_SESSION['RSLOCATION']['LOCATION']['CITY_NAME'];
If (empty($City)) {
$City = CRS_Location::GetCityName()['CITY_NAME'];
if (!empty($City)) {
$_SESSION['RSLOCATION']['LOCATION']['CITY_NAME'] = $City;
}
}
if (empty($City )) {
if (\Bitrix\Main\Loader::includeModule('olegpro.ipgeobase')) {
$arIpGeo = \Olegpro\IpGeoBase\IpGeoBase::getInstance()->getRecord();
$City = $arIpGeo['city'];
if (!empty($City)) {
$_SESSION['RSLOCATION']['LOCATION']['CITY_NAME'] = $City;
}
}
}
Answer the question
In order to leave comments, you need to log in
g-rain-design.ru/blog/posts/bitrix-composite-cache there is an interesting article, you can look
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question