Docs
Caching
Customizing Field Behavior

Customizing the Behavior of Cached Fields

You can customize how a particular field in your Apollo Client cache is read and written. To do so, you define a field policy for the field. A field policy can include:

  • A read function that specifies what happens when the field’s cached value is read
  • A merge function that specifies what happens when field’s cached value is written
  • An array of key arguments that help the cache avoid storing unnecessary duplicate data.

Please read the “Customizing the behavior of cached fields” chapter on Apollo Client documentation.