server-side cache for a graphql datasource?
See original GitHub issueNow we have an official REST datasource with cache enabled, while maybe I missed it in the doc but I am wondering how to do server-side cache for a graphQL datasource (like prisma)?
Theoretically it would be just the same logic with the caching strategy on apollo-client: we get some data from a graphql query, normalize it into a memory/redis cache, (and for what the client-side does’t have, we should config expiration time for them); when dealing with another query, just check the cache first (the logic has been already done in apollo-client).
So any recommended way to do this on the server-side? Is it possible to add a new data access layer between a graphql datasource (prisma) and our apollo-server (prisma <-> [an apollo-client like cache layer] <-> apollo-server) ?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:9 (3 by maintainers)
Top GitHub Comments
+1 for server-side caching
Apollo-client is just doing nearly the same thing: sending graphql requests, normalizing the returned JSON into
__typename:id
key-value cache. Is it feasible to just use apollo-client with a redis cache to achieve this on the server-side?