Cache Mediator
The cache mediator will evaluate the hash value of an incoming message as described in the optional
hash generator implementation (which should be a class implementing the org.wso2.caching.digest.DigestGenerator interface).
The default hash generator is 'org.wso2.caching.digest.DOMHashGenerator'. If the generated hash value has been
found in the cache then the cache mediator will execute the onCacheHit sequence which can be specified inline or
referenced. The cache mediator must be specified with an 'id' and two instances with this same 'id' that correlates
the response message into the cache for the request message hash. The optional 'timeout' specifies the valid duration
for cached elements, and the scope defines if mediator instances share a common cache per every host instance, or per
every cache mediator pair (i.e. 'id') instance. The 'collector' attribute 'true' specifies that the mediator instance
is a response collection instance, and 'false' specifies that its a cache serving instance. The maximum size of a
message to be cached could be specified with the optional 'maxMessageSize' attributes in bytes and defaults to unlimited.
Finally the 'implementation' element may define if the cache is disk or memory based, and the 'maxSize' attribute defines
the maximum number of elements to be cached.
-
Cache Id: Id for the cache configuration. You should have same id for a cache mediator instance in incoming path and the corresponding
mediator instance in outgoing message path.
-
Cache Scope: Scope of the cache. This is important if the service is deployed in a cluster.
-
Per-Host: The cache is kept only for the current host in a cluster.
-
Per-Mediator: The cache is kept once for the whole cluster.
-
Cache Type: Whether the mediator is in the incoming path (check request) or the outgoing path (cache the response).
-
Finder: Set if the message is incoming path. This indicate the mediator find for the request hash of each incoming message.
-
Collector: Set if the message is in outgoing path. This indicate the mediator collect the response message in the cache.
-
Hash Generator: The logic for finding the hash which check against each incoming message. Default to org.wso2.caching.digest.DOMHASHGenerator
-
Cache Timeout: The cache timeout(The time to keep the cache before expiring) in seconds.
-
Maximum Message Size: The limit of the message to cache in bytes.
-
Implementation Type: Currently only "In-Memory" is available.
-
On Cache Hit: Specify the sequence to follow when the cache mediator is hit. You can either specify it as anonymous where you can define child mediators
for the Cache mediator or you can refer a named sequence of mediators from the registry.