Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I'm working on solution when many sites are linked with each other via tags like
<link rel="alternate" hreflang="en-uk" href="http://example.uk" />
<link rel="alternate" hreflang="ru-ru" href="http://example.ru" />
The data for this tag is get from external storage periodically.
The issue is that metatg module saves everything into permanent cache.
Attached patch introduces one more hook which allows custom modules to modify metatag cache expiration time. Patch will not affect existing installations.
Comment | File | Size | Author |
---|---|---|---|
#17 | metatag-n2832427-17.patch | 1.28 KB | DamienMcKenna |
| |||
#17 | metatag-n2832427-17.interdiff.txt | 1.14 KB | DamienMcKenna |
#15 | metatag_cache_expiration_time-2832427-3.patch | 1.2 KB | e2thex |
| |||
#9 | metatag_cache_expiration_time-2832427-2.patch | 1.15 KB | e2thex |
| |||
#2 | metatag_cache_expiration_time-2832427-1.patch | 1.15 KB | dmitry.kazberovich |
Comments
Comment #2
dmitry.kazberovichComment #3
dmitry.kazberovichComment #4
awm CreditAttribution: awm commentedmaybe you can add your tags in hook_page_build
Also see https://www.drupal.org/node/2062379
which fixed the use of permenant cache.
Comment #5
e2thex CreditAttribution: e2thex for Johnson & Johnson commentedI have tested that this patch allows other modules to change the expiration but does not change the default behavior.
(Note: I am working on the same project as Dmitry, and doing the code review. JnJ has multiple vendors work and reviewing code.)
Comment #7
e2thex CreditAttribution: e2thex for Johnson & Johnson commentedawm,
I did not see anything in that thread that talk about hook_page_build.
Comment #8
awm CreditAttribution: awm commentedThe issue in https://www.drupal.org/node/2062379
Fixes the issue of metatags being set permenant cache.
As op has stated, his issue is
and the patch in that thread fixes this behavior.
From the maintainer of metatag:
Comment #9
e2thex CreditAttribution: e2thex for Johnson & Johnson commentedUpdate patch to be against latest dev version (I think it is just location that is changed)
I will wait for it to pass before moving to reviewed again.
Comment #10
e2thex CreditAttribution: e2thex for Johnson & Johnson commented@awm,
I am not seeing anything in that thread that says the correct way to say you do not want something to cache permanently. Can you point out the comment? Is Dave read saying that we should not cache permanently but I think that is exactly what the module does.
Comment #11
e2thex CreditAttribution: e2thex for Johnson & Johnson commented@awm it is worth noting that in https://www.drupal.org/node/2062379#comment-8340685 it is stated the the reason for making a single metatag cache clear function is so that in the future functionality could be added. and that is what we are doing here.
Comment #12
awm CreditAttribution: awm commented@e2thex fair enough. I was trying to point out that metatags for an entity with proper cids (i.e. output:..) gets flushed on entity save when the metatag_metatags_cache_clear($entity_type, $entity_id); is called. this function clear cache entries with CACHE_PERMENANT expire flag by passing the cid to cahce_clear_all
Comment #13
DamienMcKennaThanks for the updated patch. Don't forget to update the issue status to "needs review" when you upload a patch.
Regardless of what testbot says, the new patch needs some *minor* tweaks - there needs to be an extra space on each of the @param variable definitions so they are underneath the "a" instead of the "p", and the place where the hook is triggered needs to have a comment that says "Triggers hook_metatag_cache_set_expire_alter()."
Comment #14
DamienMcKennaComment #15
e2thex CreditAttribution: e2thex for Johnson & Johnson commented@DamienMcKenna,
Thanks for the response I made the tweaks of which you spoke.
Comment #16
e2thex CreditAttribution: e2thex for Johnson & Johnson commentedComment #17
DamienMcKennaSome minor polish.
Comment #18
e2thex CreditAttribution: e2thex for Johnson & Johnson commentedThank you @DamienMcKenna
Comment #20
DamienMcKennaCommitted. Thanks everyone!