Documentation Center

Configuring in-memory caching of GraphQL requests

Aside from the main embedded caching of published content on the server, Content Delivery also lets you configure an in-memory cache, specifically used to cache GraphQL requests.

About this task

If a client makes a large number of GraphQL queries in quick succession, this can overwhelm the Content Service. If you find this to be the case in your setup, you can mitigate against this, you can configure this cache by configuring a number of properties in the application.properties file of the Content Service.

Procedure

  1. Enable in-memory caching of GraphQL requests by ensuring that the property graphql.request.caching.enabled resolves to the value true.
  2. Configure the maximum amount of time between requests, in milliseconds, below which in-memory caching is triggered, by ensuring that the property graphql.request.caching.buffer.time resolves to that number. This property defaults to the value 2000.
  3. Configure the size of the cache, in number of items, by ensuring that the property graphql.request.caching.capacity resolves to that number. This property defaults to the value 10.
  4. Configure the TTL (time to live) of the items in the cache, in seconds, by ensuring that the property graphql.request.caching.ttl resolves to that number. This property defaults to the value 60.