Gato GraphQL logo

Field Resolution Caching

Field Resolution Caching

Addition of the @cache directive to the GraphQL schema, which stores the result from a field in disk for a requested amount of time. When executing the same field within that time span, the cached value is returned.

This directive can boost performance when executing expensive operations (such as when interacting with external APIs), as we can cache and reuse their response.

query {
  posts {
    id
    title
      @strTranslate(from: "en", to: "es")
      @cache(time: 10)
  }
}