M
M
Mikhail Smirnov2017-02-10 20:32:30
PHP
Mikhail Smirnov, 2017-02-10 20:32:30

How does caching work in Bitrix?

Hello!
Tell me how caching works in Bitrix (business version)?
a specific list of products (everything is clear with the detailed product page)
example:
There is a product catalog 8 products
per page 4 products are displayed (total 2 pages)
users walk through the catalog, the pages are saved in the cache
and if I edit product number 8, which is on the second page, then when you go to the first page (which does not have this product), will the cache be recreated?
why am I all this:
There is a catalog of goods, in the list of goods there is a button to the basket and to the wish list, with standard catalog settings, this data is cached and it turns out how not to mark for a particular user, there is a product in the basket or in the wish list. The data goes to the cache and it is shown to another user that the product of the type is in the basket. Also, depending on the user group, some products are shown or hidden. For this I did this:

<?$APPLICATION->IncludeComponent("bitrix:catalog", "", array(
"USER_DATA" => $arUserData,
),
    false
);?>

the $arUserData array contains data about the products added to the cart, the wish list and the user's group.
As far as I understand, the cache id is collected from the data of this array.
And now there are big brakes in the catalog. At the first visit to the page, it is loaded in 15 - 20 seconds, with the subsequent less than 1 second. But after a while (1 - 5 minutes) again the same thing.
directory cache settings:
"CACHE_TYPE" => "A",
    "CACHE_TIME" => "36000000",
    "CACHE_FILTER" => "Y",
    "CACHE_GROUPS" => "Y",

Can you tell me the correct approach I'm using? Or can it be done in some other way?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Tikhonov, 2017-02-10
@fortoster83

in the catalog, each product has a button or link to buy - add class='product_ajax_id_product'
on the page there is a small basket

$mas_elem - сюда собираешь товары (их id) - которые добавлены в корзину
$obj_count=CUtil::PhpToJSObject($mas_elem); - здесь у тебя js массив

you run through this array and do the necessary actions with the buttons in the
same way as with the wish list
, that’s the whole task
of PS - in principle, you don’t need to do anything with the catalog.section component - just add this class to each product)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question