0

Reading through the Relay docs I am confused about the concept of Cache mentioned in the network layer (https://facebook.github.io/relay/docs/en/network-layer.html) vs the Relay Store (https://facebook.github.io/relay/docs/en/relay-store.html).

Are these two different caches? Which one does automatically get garbage collected by Relay?

anon
  • 1,101
  • 3
  • 17
  • 33

1 Answers1

0

@anon the network layer is how you connect the client to your GraphQL server, creating a store on your application, to cache the data. The second link is more about how you update the store using the updater function after running a mutation for example.

As you can see on the first link:

// Create a network layer from the fetch function
const network = Network.create(fetchQuery);
const store = new Store(new RecordSource())

you are creating the network layer/store using the relay-runtime package.

Hope it helps :)

denyzprahy
  • 820
  • 11
  • 24