Customizing the Behavior of Cached Fields

Learn how to customize cached fields in Apollo Client by defining field policies with read and merge functions. Optimize your cache with key arguments. Read more at the Apollo Client documentation.

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.