The "wso2caching" module is a web services caching module for WSO2 ESB and Apache Axis2. This implements both the server side and client side caching.
You can also configure the "wso2caching" module on a service level. See Response Caching.
Follow the instructions below to configure the "wso2caching" module on a global level.
1. Find the "wso2caching" module in the "Deployed Modules" list and click "Configure." See Configuring Modules to access the "Deployed Modules" page.
2. The "Global Caching Configuration" page appears.
3. In the "Enable Caching" list, select "Yes."
4. The last saved configuration or the default configuration (if it is the first time) for caching is displayed.
Fields in Wizard:
- Hash Generator - This specifies the fully qualified class name of the hash value generator. This class implements the
org.wso2.caching.digest.DigestGeneratorinterface. It is responsible for generating a Hash value for each request message, so that a matching response message can be located from the cache. The default is
org.wso2.caching.digest.DOMHASHGenerator. You can implement your own Hash generator class and use it with WSO2 ESB. However, the default hash generator should be good enough for general use.
- Timeout - This is the time period, in milliseconds, which a cached response is kept in memory for. The counting starts from the time the first request is received. Any request received after the counter has started and is within the Timeout period, is served with the response cached upon receiving the first request. Once the Timeout expires, the cache will be updated with the response generated for the first request that was received after the expiry.
- Maximum Cache Size - This holds the maximum number of response messages that will be cached. If the maximum number of responses are already cached and none of the cached responses' Timeouts have expired, then future responses are not cached until this memory is free enough to accommodate caching a new response.
- Maximum Message Size - The response message that is cached. Response messages larger than this (in size) are not cached. Caching is an expensive operation for larger messages, especially given the amount of memory required. Therefore this value should be set considering the performance and resource trade-offs.
It is advised that you consider the dynamic nature of your services before you enable caching globally. For example, an operation that is supposed to generate random numbers would not benefit from caching previous responses, because it is supposed to generate a unique response for each invocation.