This documentation is for WSO2 API Manager 1.10.0 View documentation for the latest release.
Page Comparison - Configuring Caching (v.7 vs v.8) - API Manager 1.10.0 - WSO2 Documentation

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Removed the JWT caching section as JWT is not available in 1.10.0.


  • Disable caching at the API Gateway by adding the following entry under the <APIGateway> element in the <APIM_HOME>/repository/conf/api-manager.xml file.

    Code Block
  • Enable the Key Manager cache by adding the following entry under the <APIKeyValidator> element in the api-manager.xml file.

    Code Block

JWT cache

You sometimes pass certain enduser attributes to the backend using JSON Web Tokens (JWT). The token is generated in the Key Manager server for each validation information object and is sent as part of the key validation response. Enable token generation by setting the following entry to true at the root level of the api-manager.xml file.

Code Block

OAuth cache

The OAuth token is saved in this cache, which is enabled by default. Whenever a new OAuth token is generated, it is saved in this cache to prevent constant database calls. Unless an OAuth expires or is revoked, the same token is sent back for the same user. Therefore, you do not need to change this cached token most of the time. 


To change the default response caching settings, edit the following cache mediator properties in <APIM_HOME>/repository/resources/api_templates/velocity_template.xml file:  

  • true: specifies that the mediator instance is a response collection instance
  • false: specifies that the mediator instance is a cache serving instance

max MessageSize  

Specifies the maximum size of a message to be cached in bytes. An optional attribute, with the default value set to unlimited.
maxSizeDefines the maximum number of elements to be cached


Defines the hash generator class.

When caching response messages, a hash value is generated based on the request's URI, transport headers and the payload (if available). WSO2 has a default REQUESTHASHGenerator class written to generate the hash value. See sample here.

If you want to change this default implementation (for example, to exclude certain headers), you can write a new hash generator implementation by extending the REQUESTHASHGenerator and overriding its getDigest() method. Once done, add the new class as the hashGenerator attribute of the <cache> element in the velocity_template.xml file.

API Store cache

The API Store has several caches to reduce the page-load times and increase its responsiveness when multiple users access it simultaneously.