A
A
Alexander2019-10-04 22:22:29
1C-Bitrix
Alexander, 2019-10-04 22:22:29

Why is the tagged cache not invalidated?

I use tagged cache.
When creating, for the /x/data/iblock_9/elements/IBModel_getDict_80e1796b0123e67e2d61d642d7d02518 directory, I add tags, including x_iblock_id_9_element_549864
5d979c200788d075152693.png
My events do not reset the cache.
I execute already literally in command line PHP
global $CACHE_MANAGER;
$CACHE_MANAGER->ClearByTag('x_iblock_id_9_element_549864');
And all the same - record in the table remains, the file remains on a disk, the cache continues to be used.
I reset the cache from the admin panel entirely. I update the page. The cache is created, but it no longer gets into the tagged cache table. Those. I see that the data is obtained from the cache. I can see the cache directory on disk, but I don't see any entries in the table for the given path (and for the tags that match it).
I read again. I update and ... the cache is not created at all. A couple more times F5 - appears.
I look at the table - not tagged.
I repeat - in the log I see how tags are added:

regtag:/x/data/iblock_9/elements/IBModel_getDict_e37b1f6c8fca86a080380103a838c138 --<pre>x_iblock_id_9_element_549864</pre>--><!-- regtag:/x/data/iblock_9/elements/IBModel_getDict_e37b1f6c8fca86a080380103a838c138 --<pre>x_iblock_id_9_element_549865</pre>--><!-- regtag:/x/data/iblock_9/elements/IBModel_getDict_e37b1f6c8fca86a080380103a838c138 --<pre>x_iblock_id_9_element_549866</pre>--><!-- regtag:/x/data/iblock_9/elements/IBModel_getDict_e37b1f6c8fca86a080380103a838c138 --<pre>x_iblock_id_9_element_549867</pre>-->

foreach ($arElms as $arElm) {
                        print ('<!-- regtag:'.$this->cDir.'/'.$cacheSubDir.'/'.$cacheKey.' --<pre>'.print_r('x_iblock_id_'.$this::IDIB.'_element_'.$arElm['ID'],true).'</pre>-->');
                        $CACHE_MANAGER->RegisterTag('x_iblock_id_'.$this::IDIB.'_element_'.$arElm['ID']);
                    }

I look at the table - EMPTY. There is a folder on the disk!
It seems that the RegisterTag and ClearByTag methods work randomly - sometimes they work, sometimes they don't.
Where to dig?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-10-04
Madzhugin @Suntechnic

You asked yourself - answer yourself:
Tagged cache does not work if the BX_COMP_MANAGED_CACHE constant is not set. Moreover, tagging does not work, including cleaning.
Those. no call to StartTagCache starts a tagged cache unless the BX_COMP_MANAGED_CACHE constant is set.
in dbconn.php or wherever you like:
define('BX_COMP_MANAGED_CACHE', true);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question