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
Are types resolved by graphql cached? #526
Comments
Yes the types are cached using GraphTypesLookup. |
But what if a graphql type is injected a resource X via the standard DI which is supposed to be "transient" or "scoped" (live as long as the request lives)? Or to put it better. Say each graphtype needs some sort of resource. What is the recommended way to inject such resource? |
You can use constructor injection coupled with a DI setup, though at this time the result will be cached and live the lifetime of the Schema. |
For something like Maybe I'm missing something though. Some of my GraphQL types need to perform queries therefore for something like:
The I should probably be reading more about the N + 1 problem's solution given in the docs. That may solve this issue as well as the issue of performance in this case. |
I'm running into a problem where it seems that GraphQL is caching something across different requests. Is it possible that either graphql types or that results of the DI resolver passed to the schema instance are cached?
In both cases there may be a bug in this library.
The text was updated successfully, but these errors were encountered: