Skip to content

How does the Graphcache work? #1822

Answered by JoviDeCroock
stingalleman asked this question in Q&A
Discussion options

You must be logged in to vote

It's a cache just like the other one but the difference is how it caches, as the explanation details, graphCache is a normalized cache and the default is a document cache.

The normalized cache will gather query-results and cache appropriately but sometimes when we're mutating data you'll need to help it out a bit. When an entity is present in the cache and we update it the normalized cache will be able to reconcile that against the data it has.

{ id: 1, text: 'hi', __typename: 'Todo' }

When the cache sees a response like this it's easy to for instance update the Todo:1.text to hi rather than what it was before, however when we are deleting/adding entities we'll need to help the cache a bi…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@stingalleman
Comment options

@JoviDeCroock
Comment options

@stingalleman
Comment options

Answer selected by stingalleman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants