Is there any documentation around `CacheKeyResolve...
# apollo-kotlin
w
Is there any documentation around
CacheKeyResolver
and
fromFieldRecordSet
and
fromFieldArguments
methods?
fromFieldRecordSet
seems like it asks for cache key for every object (non-scalar) in the response? But what does
fromFieldArguments
do?
m
There's not much unfortunately, mostly because we should really change these APIs
From the exemple there:
Copy code
query AuthorById($id: String!) {
  author(id: $id) {
      id
      name
    }
  }
}
fromFieldArguments
tells the cache to use the id from the arguments
fromFieldRecordSet
tells the cache to use the id from the response
w
I suspected something like that but didn’t see it explicitly. So the
fromFieldArguments
has preference over
fromFieldRecordSet
when computing cache for the object directly under a field? In your example, if
fromFieldArguments
returns the ID, does
fromFieldRecordSet
still need to run?
m
They run at different time.
fromFieldArguments
will run before the network to check if there's something in the cache.
fromFieldRecordSet
will run after to store the value in the cache
👍 1
w
Got it, thank you 🙂