- Issue created by @ultimike
- 🇺🇦Ukraine osab Germany, Baden-Württemberg; Ukraine, Kharkiv
Hello Michael! Thank you for the question. I will try to answer based on my understanding. Please do not consider my answer to be absolute truth )).
So yes, I see such behavior for admin user also. Here the
"keys":["demo_child"]
plays role.
- On the page we have setting"contexts":["url.query_args"]
(block 04). That means to invalidate cache if URL query arguments changed, what happened after adding?test=1
.
- We have"max-age":20
also. So, 20 sec the page is unchangable (block 02).
- But we also have"max-age":40,"keys":["demo_child"]
(block 03). And this block from 21 to av. 40 second will stay freezed (cached) because of "keys". The "keys" is like specific mark means "do not touch this part during invalidation because of some "heavy" calculation here or smth". And then, after 40 sec the "max-age" comes into force and block 03 updates.To make sure, that's all works in this way, try to change parameters. For example if you remove
"max-age":40
for block 03, after 20 sec all others will get new times, but block 03 become cached.
At the same time, if remove"keys":["demo_child"]
, the block 03 will be changed after 20 sec along with others.More info I saw here https://bluetext.com/blog/drupal-8-render-caching/,
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21....As for "block" naming, yes you're right. That is not good choice. Initially, I've added plugin blocks for lazy-builder and then called other parts as "blocks" also. I don't know, maybe "sections" wil be better? What would you advise?
- Status changed to Needs review
8 months ago 12:33pm 8 May 2024 - 🇺🇸United States ultimike Florida, USA
@osab - Thanks for your response. The fact that a custom cache key causes the render array to be cached independently of the rest of the page is helpful and explains what I'm seeing on /cache-review/cached-max-age
As for the naming, I think that in the Cache Review sample pages, using the word "section" is much better than using "blocks", IMHO.
-mike
- 🇺🇦Ukraine osab Germany, Baden-Württemberg; Ukraine, Kharkiv
Hi!
I've updated naming in https://www.drupal.org/project/cache_review/issues/3446118 📌 Add basic test and setup CI Needs work . Only couple blocks and all others are sections there.