-
-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add HTTP cache tags #2553
base: 2.9
Are you sure you want to change the base?
Add HTTP cache tags #2553
Conversation
This might partially work, but I would suggest to at least also also add cache clearing to |
Partially is still better than never 😁.
Makes sense 👍. I will add it to the PR. |
I have added it to |
@@ -227,6 +228,10 @@ public static function deleteForPageAndModuleOrExpired($intPage, $intModule) | |||
public static function purge() | |||
{ | |||
Database::getInstance()->query("TRUNCATE " . static::$strTable); | |||
|
|||
if (System::getContainer()->has('fos_http_cache.cache_manager')) { | |||
System::getContainer()->get('fos_http_cache.cache_manager')->invalidateTags(['contao.db.tl_iso_product']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would not clear the reader pages though, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only the product list uses the ProductCache
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but this method is called all over the place where the cache of products should be cleared. E.g. if the store configuration is changed, the reader pages might display a wrong currency. So it would kinda make sense to clear them as well? Although we would be better off actually implementing the correct tags. Which is why this might not make sense as a quick fix in 2.9 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although we would be better off actually implementing the correct tags.
I can add the additional cache tags in this PR if you want.
Which is why this might not make sense as a quick fix in 2.9
Why? It's a bug in 2.9 and can easily be fixed there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk, its also a feature of Contao that is not supported by Isotope 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HTTP caching you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cache tags
Currently, if a page with a product list is in the shared HTTP cache and a new product is added, deleted or a product is changed, the cache will not be invalidated. Likewise if a product detail is in the shared HTTP cache and that product is changed, the shared cache is also not invalidated.
This PR fixes that by adding at least the general
contao.db.tl_iso_product
cache tag for any product list and thecontao.db.tl_iso_product.*
cache tag for any product detail. Both will get automatically invalidated by theDataContainer
in the back end when editing products.