The Caching component is used to cache responses for similar requests. Two requests will be served with the same cached response (if exists) if the unique hash value, generated internally, for the latter message is the same as that of the former. Caching can be enabled at service or operation level. It can also be enabled at global level though it is not recommended to use in a production system. The global level engagement of caching will apply caching for all the messages coming into the server. Service level engagement will effect for the messages coming to the particular service only. Operation level engagement will focus only on messages coming to the particular operation. The user interface (UI) of the Caching component supports global and service level engagement of caching only.
The following diagram shows the user interface of the Caching component.
The "Enable Caching?" option is used to enable or disable caching. If you select "Yes", it will show the existing (if not, the default) configuration for caching on the UI. The "Finish" button is used to persist the alterations done on these configurations, back on the server.
Hash Generator : This specifies the fully qualified class name of the hash value generator. This class should implement the org.wso2.caching.digest.DigestGenerator interface and is responsible for generating a hash value for each message.
Timeout : This is the time period, in milliseconds, that a cached response is kept in memory. The counting starts from the first response. Any request coming after that within the timeout period is served with the cached response.
Memory Cache Size : This is the memory allocated for cached responses. If the memory limit is full and none of the cached responses are expired then future responses are not cached until this memory is freed enough to accomplish caching the particular response.
Max Message Size : Messages (i.e. responses) larger than this value in size are not cached. Caching is an expensive operation for larger messages. Therefore this value should be set considering the required level of caching and performance.
Finish : To submit the currently shown configuration
Reset : To load the last saved configuration
Default : To load the default configuration
Clear : To clear all text areas in the UI
Cancel : To cancel the configurations which are not submitted and go back to the previous page