Configure caching

Caching increases HTTP response speed, reduces the load on your origin server, and prevents the generation of duplicate responses. You can configure caching options at the API, downstream, and resource levels.

API: You can also complete this task by using the API Endpoints API. Run the Edit cache settings operation. Learn more about Akamai’s APIs.

Before you begin

Ensure that you understand the implications of caching so that you refrain from caching sensitive information. For details about the caching options that Akamai offers, see the “Caching” section in the Edge Server Configuration Guide in Control Center.

How to

  1. On the API Definitions page, in the Registered APIs section, click the ellipsis icon () associated with the API configuration you want to configure caching settings for.
  2. From the menu, select Manage versions.
  3. In the Version history panel, click the ellipsis icon () associated with the API configuration version you want to configure caching settings for.
  4. From the list of delivery options, select Caching.
  5. On the Caching settings page, set the Enable caching switch to Yes.
    The caching settings that you configure in API Gateway control the caching of your registered API. If this switch is set to Yes, any caching settings that you specified for the hostnames associated with your API in Property Manager do not apply.
  6. In the API caching section, from the API endpoint caching menu, select the type of caching that you want to implement.
    For your API caching configuration, you can serve the content from the origin and clear any versions from the cache (no store), serve the content from the origin but do not remove cached versions (bypass cache), cache the content, or honor the caching headers from your origin.

    The caching settings that you configure at this level apply to all resources within your API. You can later change the caching settings for individual resources.

  7. Do one of these steps:
    If...Then...
    If you selected No store or Bypass cache, then move on to the next step.
    If you selected any other option, then do these steps:
    1. In the Max age field, enter the maximum time for caching content.

      A setting of 0 means no-cache, which forces origin revalidation before serving the content. For the caching options that honor origin headers, this max age is only used when the origin does not specify one.

      Note: You can specify this parameter in seconds, minutes, hours, or days. In each case, the value must be between 1 and 1000000.
    2. Optional: To serve expired objects when revalidation with the origin server is not possible, set the Serve stale objects on origin error switch to Yes.
    3. To set up an automatic refresh of your cached API content, set the Enable cache prefreshing switch to Yes.
    4. In the Percentage of max age field, enter the percentage of content’s TTL at which the content should be refreshed.
  8. Optional: Configure HTTP error caching. See Cache HTTP error responses.
  9. Optional: Configure downstream caching. See Configure downstream caching.
  10. Optional: Configure cache key query parameters. See Configure cache key query parameters.
  11. Optional: Configure caching for individual resources. See Configure resource caching.