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

ctx and Prisma instance question #8

Closed
brikou opened this issue Sep 10, 2018 · 4 comments
Closed

ctx and Prisma instance question #8

brikou opened this issue Sep 10, 2018 · 4 comments

Comments

@brikou
Copy link

brikou commented Sep 10, 2018

Hi great repo, 1.17 looks fantastic!

I have a real question: why do you attach prisma to context instead of doing a regular import of the instance?

@timsuchanek
Copy link
Contributor

@brikou the reason is, that when you want to use the Dataloader with full Cache later, you don't need to change your code. So this basically means, that on each request, a new Client instance is created. It's not used right now, but will later help to enable caching on a request basis.

Does this answer your question?

@brikou
Copy link
Author

brikou commented Sep 11, 2018

Ok I see but since cache is not used, we should remove it. Then add an example with this cache feature. Thanks for your insight.

@abhiaiyer91
Copy link
Contributor

abhiaiyer91 commented Sep 11, 2018

The intention of this is to establish patterns we think will help for working with Prisma. By attaching the Prisma within context, we establish a pattern for your code that can take advantage of caching once we enable that feature. When we release it people can take advantage of it for free.

By all means though import Prisma in your own files if it makes sense for you

@brikou
Copy link
Author

brikou commented Sep 12, 2018

Thanks @abhiaiyer91, can't wait to see the cache feature coming

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

3 participants