I try to understand how drupal core cache tags is add :
this is my tags on my home when i am logged :
node:121 node:158 node:23945 node:23946 node:43328 node:491 node:514 node:59139
It's good, this relate my node on my home.
But if i check my home in anonymous, this is what i get :
node:115 node:121 node:153 node:158 node:172 node:18240 node:18244 node:18256 node:23945 node:23946 node:307 node:43328 node:45 node:491 node:514 node:59139 node:59143 node:59144 node:59145 node:59146 node:59147 node:59148 node:59149 node:59193 node:59197 node:59239 node:59269 node:59283 node:59289 node:59293 node:59522 node:59770 node:60375 node:60390 node:60415 node:60418 node:60480 node:60542 node:60606 node:60616 node:60727 node:60785 node:60793 node:60819 node:60824 node:60827 node:60873 node:66011 node:66019 node:66026 node:66028 node:66030 node:66036 node:66039 node:8555 node:8561
And most of this tag is wrong for the home page, how drupal find them ?
I know there is a cache context, but its the core who add this tags
After some debug i got some answer :
Context : my menu is render by core block menu in region.
For anonymous user, drupal add the tag node:id for every item in my menu.
if i remove the block, all node:id tag is removed.
So i have 2 solutions :
- For all user who hasn't bypass node access permission drupal add every tag from the menu block render.
So i can try to fix the access check on the menu
- Remove the drupal core block menu from region and build my own block programmatically and load my menu inside with menu_tree service.
i have try the second point and since its not drupal who render my custom block, tags is not add.
But for me the best way is to find a way for fix the check access.
i can't clear all the node in the cache when someone edit a node in the menu.
For that i want use the tag menu_link_item but not the node:id...