-
-
Notifications
You must be signed in to change notification settings - Fork 799
Move cache configuration to options #8793
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
/AddOperationCache
methods toSchemaOptions
properties - 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.
src/HotChocolate/Fusion-vnext/src/Fusion.Execution/Execution/FusionOptions.cs
Outdated
Show resolved
Hide resolved
src/HotChocolate/Fusion-vnext/src/Fusion.Execution/Execution/FusionOptions.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
e5d91a1
to
56f1043
Compare
static sp => | ||
{ | ||
var options = sp.GetRequiredService<SchemaOptions>(); | ||
return new DefaultDocumentCache(options.OperationDocumentCacheSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: This is not good. It will re-create the cache for each executor.
We need it scoped to a specific schema, but not executor.
No description provided.