- Issue created by @Anybody
- Merge request !17DIRTY QUICKFIX: Implemented quickfix to disable caching on dfp_tags (#3427684) → (Open) created by Anybody
- Status changed to Needs work
9 months ago 5:12pm 13 March 2024 - 🇩🇪Germany Anybody Porta Westfalica
Just verified this. With the quickfix the ads targeting is now correct.
This needs to be solved cleanly.
This is an issue for anyone using the hook as described in the .api.php file.
- 🇩🇪Germany Anybody Porta Westfalica
Looking into this, I think the right way might be to implement / override
Tag::getCacheTags()
as this is being called in TagViewBuilder:
CacheableMetadata::createFromObject()
That method should then include cache tags for all relevant (varying) attributes like
$targeting
, I think?What do the maintainers say? Am I right or any better way?
- Merge request !18Tried to implement a fix, but doesn't seem to work yet. → (Open) created by Anybody
- 🇩🇪Germany Anybody Porta Westfalica
In MR!18 I tried implementing a fix, but it doesn't seem to work. Happy to get some feedback and ideas how to solve this best.
- 🇩🇪Germany Grevil
Had a quick chat with @alexpott on slack, he suggests creating a test, which reproduces the issue so it is easier to get into the in's and out's.
- 🇩🇪Germany Anybody Porta Westfalica
I modified the MR!17 quick fix a bit, as we found out that the
$cacheable_metadata
part was overriding our max-age value. If we set it afterwards, it also works and is much simpler.So it seems the
max-age = -1
set by the$cacheable_metadata
is causing the array to be never-reevaluated even with different keys... - 🇩🇪Germany Anybody Porta Westfalica
@Grevil: Looking at several core examples, I come to the conclusion, that our cache keys are the correct approach, but this line may cause the trouble:
$cacheable_metadata = CacheableMetadata::createFromObject($global_settings);
as I think that will add the unwanted
max-age=-1
?
For me it makes sense, that something static like the settings may be cached forever... should we really use this as basis?So for the next step I'd says, first check where the
max-age=-1
comes from and let's eliminate that as possible root cause. I think the implementation wasn't fully correct.Maybe then our keys will already work...
- 🇩🇪Germany Anybody Porta Westfalica
Okay they won't ... still I think that point is close to the reason...
So perhaps let's look into core for similar cases and other implementations of
CacheableMetadata::createFromObject
etc. - 🇩🇪Germany Grevil
This is now fixed in #3220030: Implement hook_dfp_tag_alter() → . Everything is documented there.