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

Question: Recommended way to clear dataloader cache between two queries execution #1127

Open
benjamindulau opened this issue Jul 13, 2023 · 0 comments

Comments

@benjamindulau
Copy link

Q A
Bug report? no
Feature request? no
BC Break report? no
RFC? no
Version/Branch 0.15.2

Sometime we need to execute a query directly through the executor, make some mutations, and then execute the exact same query again so we get the updated result all in the same code execution. In this case the dataloader would not fetch data again for the second query but would get it directly from its internal cache. Normal behavior.

Instead of manually clearing the cache each time developers have to implement this type of use case, I'd like to automatically clear the dataloader cache between each query execution.

My first thought would be to create an event listener on the pre_executor event which would clear the cache on all the dataloader services.

Is there a better and recommended way to achieve this?
Is there a way to apply this only when the query was not initiated through HTTP?

Thanks!

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

No branches or pull requests

1 participant