Skip to content
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

fix(response-cache): respect subgraph cache control TTL value #8334

Merged
merged 6 commits into from
Jan 29, 2025

Conversation

ardatan
Copy link
Owner

@ardatan ardatan commented Jan 27, 2025

Blocked by n1ru4l/envelop#2392
Fixes graphql-hive/gateway#542

When a subgraph returns cache control headers with a certain TTL, respect that during the calculation of overall TTL in the response cache plugin.

So this removes the extra configuration in the test, TTL is inherited from the subgraph response automatically.

For example, if there is a subgraph using Apollo Server that defines the default TTL without any @cacheControl directives. It prevents the response cache plugin to set the TTL infinite(which is the default of the response-cache plugin)

Copy link
Contributor

github-actions bot commented Jan 27, 2025

Apollo Federation Subgraph Compatibility Results

Federation 1 Support Federation 2 Support
_service🟢
@key (single)🟢
@key (multi)🟢
@key (composite)🟢
repeatable @key🟢
@requires🟢
@provides🟢
federated tracing🟢
@link🟢
@shareable🟢
@tag🟢
@override🟢
@inaccessible🟢
@composeDirective🟢
@interfaceObject🟢

Learn more:

Copy link
Contributor

github-actions bot commented Jan 27, 2025

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-mesh/plugin-response-cache 0.103.13-alpha-20250129133641-c2ad468bab5a1293a6fbcc61acfd9c4ba0ae3d7b npm ↗︎ unpkg ↗︎

Copy link
Contributor

github-actions bot commented Jan 27, 2025

💻 Website Preview

The latest changes are available as preview in: https://d24228eb.graphql-mesh.pages.dev

@ardatan ardatan requested a review from EmrysMyrddin January 27, 2025 15:41
@ardatan ardatan force-pushed the respect-cache-control branch from dd17af8 to c2ad468 Compare January 29, 2025 13:34
@ardatan ardatan merged commit fafb1c9 into master Jan 29, 2025
18 checks passed
@ardatan ardatan deleted the respect-cache-control branch January 29, 2025 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Respect the subgraph response's Cache Control header while setting the TTL
2 participants