首页 文章

查询WSO2 DSS / ESB中的缓存响应

提问于
浏览
0

我有一个Oracle数据库视图,包含大约8000名员工的详细信息 . 我需要从该视图填充员工搜索建议 . 我打算使用WSO2 DSS / DSS ESB为其创建数据服务 . 而是查询每个服务调用的视图,我正在考虑在DSS / ESB中缓存整个视图并查询缓存以查找所有过滤查询(“like”,“where”查询),直到缓存过期 .

ESB / DSS是否有与上述情况相关的可能性?

提前致谢 .

1 回答

  • 1

    您可以将 cache mediator与WSO2 ESB一起使用:

    <proxy xmlns="http://ws.apache.org/ns/synapse" name="Test" transports="https http" startOnLoad="true" trace="disable">
        <description/>
        <target>
            <inSequence>
                <cache id="someCache" scope="per-host" collector="false" hashGenerator="org.wso2.caching.digest.DOMHASHGenerator" timeout="10">
                    <onCacheHit>
                        <log level="custom">
                            <property name="debug" value="incache"/>
                        </log>
                        <header name='To' action="remove"/>
                        <send/> <!-- send back previous reponse, outSequence will not be executed -->
                    </onCacheHit>
                    <implementation type="memory" maxSize="1000"/>
                </cache>
                <send> <!-- Current request (hash) has not been found in the cache -->
                    <endpoint>
                        <address uri="http://myhost:8080/myapp/MyService"/>
                    </endpoint>
                </send>
            </inSequence>
            <outSequence>
                <cache id="someCache" scope="per-host" collector="true"/> <!-- Add this response to the cache -->
                <log level="custom">
                    <property name="debug" value="outseq"/>
                </log>
                <send/>
            </outSequence>
        </target>
    </proxy>
    

    在inSequence中,如果缓存中存在当前请求,则将使用先前的响应执行“onCacheHit”中介 . 否则,将执行到 endpoints 的“发送”

    在outSequence中,您将响应添加到缓存

相关问题