Move cache configuration to options#8793
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR moves cache configuration from separate service collection methods to the standard GraphQL options pattern, consolidating cache size settings with other schema options for better consistency and discoverability.
Key changes include:
- Moving cache size configuration from
AddDocumentCache/AddOperationCachemethods toSchemaOptionsproperties - Adding proper validation that throws exceptions for invalid cache sizes instead of silently clamping values
- Updating documentation and tests to reflect the new configuration approach
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md | Added migration documentation showing the old vs new cache configuration patterns |
| src/HotChocolate/Fusion-vnext/src/Fusion.Execution/Execution/FusionOptions.cs | Updated cache size validation to throw exceptions instead of silently clamping values |
| src/HotChocolate/Core/test/Execution.Tests/WarmupRequestTests.cs | Simplified service provider access by removing GetCombinedServices() calls |
| src/HotChocolate/Core/test/Execution.Tests/PreparedOperationCacheTests.cs | Updated test to use new ModifyOptions pattern instead of AddOperationCache method |
| src/HotChocolate/Core/test/Execution.Tests/DocumentCacheTests.cs | Added new test for document cache configuration using the new options pattern |
| src/HotChocolate/Core/src/Types/SchemaOptions.cs | Added cache size properties with validation and updated FromOptions method |
| src/HotChocolate/Core/src/Types/IReadOnlySchemaOptions.cs | Added cache size property definitions and fixed truncated comment |
| src/HotChocolate/Core/src/Execution/RequestExecutorManager.cs | Updated cache instantiation to use schema options instead of separate options classes |
| src/HotChocolate/Core/src/Execution/DependencyInjection/RequestExecutorServiceCollectionExtensions.cs | Removed deprecated AddDocumentCache and AddOperationCache methods |
| src/HotChocolate/Core/src/Execution/DependencyInjection/InternalServiceCollectionExtensions.cs | Removed TryAddDefaultCaches method that registered the old cache options |
| src/HotChocolate/Core/src/Execution/Caching/PreparedOperationCacheOptions.cs | Deleted obsolete cache options class |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
tobias-tengler
commented
Oct 10, 2025
tobias-tengler
commented
Oct 10, 2025
e5d91a1 to
56f1043
Compare
56f1043 to
f254399
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
f254399 to
caba57d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8793 +/- ##
============================
============================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IRequestExecutorOptionsMonitor, since async configuration is no longer used