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

About caching in tutorial #97

Open
hdlinh1808 opened this issue Nov 1, 2022 · 1 comment
Open

About caching in tutorial #97

hdlinh1808 opened this issue Nov 1, 2022 · 1 comment

Comments

@hdlinh1808
Copy link

hdlinh1808 commented Nov 1, 2022

Hi,
Int the README.md, I found:
This implementation contains a very basic cache that is intended only to be used for short lived DataLoaders (i.e. DataLoaders that only exist for the life of **an http request**). You may use your own implementation if you want.
But when I test, I found that it cache for many requests. So I have the questions:

  • What is default of the cache (TTL)?
  • If I want cache for only the life of a http request, How can I make with only one dataloader object easily?

Thanks,
Linh

@vuon9
Copy link

vuon9 commented Nov 1, 2022

Not sure if it can help, but you could consider to init the dataloader for each request then include it into the context of the request, rather than init the dataloader for the whole application. And in the last middleware of the request, you can call ClearAll for each dataloader to ensure you clean its memory.

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

2 participants