Skip to content

chore(HttpCache): outsource cache tag collection into normalizer events #5753

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

Closed
wants to merge 1 commit into from

Conversation

usu
Copy link
Contributor

@usu usu commented Aug 17, 2023

Q A
Branch? 3.1
Tickets
License MIT
Doc PR

This PR outsources the collection of cache tags for HTTP cache into individual events triggered from the normalizers instead of hardcoding into the the normalizers. This allows users to override or extend the cache tag logic with their own implementation.

This is related to #5650, where I brought up the idea:

Would it makes sense to outsource the actual calculation of the cache tags into seperate event listeners instead of hard-baking it into AbstractItemNormalizer? This would it make easier for users to extend or overwrite the cache tag generation with their own logic.

The same events could later be extended for other purposes where we need to trigger side effects during normalization (e.g. to collect push resources). And of course can be used by users for other user specific business logic.

Should this be documented somewhere? And if so, where and how?

@usu usu force-pushed the chore/events-for-cache-tags branch from 02e2af2 to a38a903 Compare August 17, 2023 06:55
@soyuka
Copy link
Member

soyuka commented Aug 17, 2023

Not a huge fan of an event dispatcher, we could just use a callback or some service. I agree that this extension point is missing today...

@usu
Copy link
Contributor Author

usu commented Aug 17, 2023

Not a huge fan of an event dispatcher, we could just use a callback or some service. I agree that this extension point is missing today...

Ok. I thought events would give more flexibility to re-use them for other purposes as well - both on api-platform side and on userland (e.g. generating list of resources to push).

But I can also make a proposal using a service instead of events.

@usu
Copy link
Contributor Author

usu commented Aug 19, 2023

Not a huge fan of an event dispatcher, we could just use a callback or some service. I agree that this extension point is missing today...

@soyuka Proposal with service instead of events is at #5758

@stale
Copy link

stale bot commented Oct 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 18, 2023
@dunglas dunglas removed the stale label Oct 19, 2023
Copy link

stale bot commented Dec 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 18, 2023
@stale stale bot removed the stale label Dec 18, 2023
@usu
Copy link
Contributor Author

usu commented Dec 28, 2023

Superseded by #5758

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants