-
Notifications
You must be signed in to change notification settings - Fork 5
Question: ApolloLink for remote schemas with cache? #42
Comments
Sounds like a great idea to me. You could simply use https://github.com/prisma-labs/http-link-dataloader I think that might work great for your use case. Or you could use Apollo client, fleshed out a bit in my separate apollo-stitcher library. https://yaacovcr.github.io/apollo-stitcher/module-apollo-stitcher.ApolloClientLink.html But you will see that code is simple, you can roll your own wrapper in a heartbeat. |
See this discussion here if remote schema supports cacheControl headers: |
The basic upshot of that is that you need a node fetch polyfill that supports caching like make-fetch-happen |
@vladar let me know if I can be of any more help, closing for now. |
Ah! I guess you may be talking about cache between runs? So you have to preserve cache to file? Then HttpDataLoader won't work, but Apollo client might be able to persist cache to file? |
https://github.com/apollographql/apollo-cache-persist/blob/master/README.md Looks like they don't support persisting to files, but avenue to that might be above package. |
Wow, thanks a ton for those links! We probably need both - query batching and caching between runs. But the first step would be to try http-link-dataloader. Thanks again 👍 |
@vladar, another option: urql, undocumented, but example available: |
Hey @yaacovCR
First of all, thanks for your fantastic work on
graphql-tools-fork
! This is truly impressive.We are going to implement some sort of caching / query batching for
gatsby-source-graphql
. Before jumping into custom implementation I decided to ask you - maybe you already did something like Apollo Http Link for remote schemas but with cache?Or maybe it is a straight stupid idea?
I'll appreciate any thoughts/advice. Thanks!
The text was updated successfully, but these errors were encountered: