我在wso2 esb中创建了一个API来调用其余服务。我已经使用了缓存介体,它对于正常的GET
方法工作正常。Cache Mediator wso2 esb api
我想要的是,我用GET
方法获取员工详细信息,我将通过url传递employee_id。
这个API调用是第一次为给定的employee_id创建服务,然后为了下一次调用同一个employee_id,它应该从缓存本身获得响应,直到给定的Timeout时间段。如果我更改employee_id,那么它应该打到服务,但它从缓存中获得响应。对于不同的employee_id也是如此。
我的API是,
<api xmlns="http://ws.apache.org/ns/synapse" name="cacheApi" context="/cacheApi">
<resource methods="GET" uri-template="/{id}/">
<inSequence>
<log/>
<cache id="" scope="per-host" collector="false" hashGenerator="org.wso2.carbon.mediator.cache.digest.DOMHASHGenerator" timeout="60">
<implementation type="memory" maxSize="10"/>
</cache>
<send>
<endpoint>
<http method="GET" uri-template="http://localhost:8080/rest-services/services/employee/{uri.var.id}"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<cache scope="per-host" collector="true"/>
<send/>
</outSequence>
</resource>
</api>
我的API调用会作为,
http://localhost:8280/cacheApi/1
http://localhost:8280/cacheApi/2
http://localhost:8280/cacheApi/3
....
谁能帮我解决这个?
在此先感谢