Problem/Motivation
Currently I don't think there's a convenient way to add cacheability metadata to the normalization via commerce product feeds events. I was thinking that might be convenient (eg. for stock or url cacheability). I've created a separate ticket to address getting cache contexts to actually work (#3229967: Support cache contexts) but I think just being able to add tags and max-age is already useful.
Proposed resolution
Make the normalization event support \Drupal\Core\Cache\RefinableCacheableDependencyInterface and pass the cacheability metadata along to the CacheableNormalization.
Remaining tasks
API changes
Drupal\commerce_product_feeds\Event\ProductVariationNormalizeEvent now implements RefinableCacheableDependencyInterface and its cacheability metadata will be passed onto the normalization.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3229969-3-do-not-test.patch | 2.43 KB | andyf |
Issue fork commerce_product_feeds-3229969
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
andyf commentedHere's a first go at that, feedback welcome, thanks! I've only done it for the variation normalization to keep the change small.
(Oh and I blindly followed the instructions for pushing changes when you've already got your own local branch, and I appear to have created a second branch on the issue fork, sorry about that! I've been working on
return-variation-normalization-cacheability.)Note I've also attached a patch for use with composer.json.
Comment #4
andyf commentedI think the test failures are down to #3229980: Fix FeedGenerationKernelTest.
Comment #5
andyf commentedGah!
Comment #6
andyf commented