简体   繁体   English

WSO2 DSS中的缓存设置

[英]Caching settings in WSO2 DSS

We have different services deployed in DSS and we have a different way of caching: 我们在DSS中部署了不同的服务,并且我们有不同的缓存方式:

  • no cache 没有缓存
  • 1 hour cache 1小时缓存
  • 1 day cache 1天缓存

Is there any way to set this caching directly to each dbs file without using the administration console? 有没有办法在不使用管理控制台的情况下直接将缓存设置为每个dbs文件?

Another way would be to set these three caches through a configuration file and then to refers to them from the dbs files. 另一种方法是通过配置文件设置这三个缓存,然后从dbs文件引用它们。

The solution we are looking for, is without using the administration console. 我们正在寻找的解决方案是不使用管理控制台。

It is indeed possible to configure caching for dataservices via a configuration file without using the management console. 确实可以通过配置文件为数据服务配置缓存,而无需使用管理控制台。 Each dataservice is deployed as form of a axis2 service. 每个数据服务都以axis2服务的形式部署。 Therefore you can use the "services.xml" file which you would typically use to configure axis2 service related parameters, with dataservices too with a slight modification. 因此,您可以使用“ services.xml”文件,该文件通常用于配置与axis2服务相关的参数,并且对dataservices也进行了少许修改。 That is, if the name of your dataservice is "TestDS" then you have to name your services.xml file as "TestDS_services.xml" and place it inside the dataservices deployment directory which can be located at "DSS_HOME/repository/deployment/server/dataservices". 也就是说,如果数据服务的名称为“ TestDS”,则必须将services.xml文件命名为“ TestDS_services.xml”,并将其放置在位于“ DSS_HOME / repository / deployment / server”下的dataservices部署目录中。 /数据服务”。 Then you can include a caching policy having your own values as the parameters inside the aforementioned configuration file. 然后,您可以将具有自己的值作为参数的缓存策略包含在上述配置文件中。 Also it is important to note that, you can engage caching in three levels for a dataservies namely, per service group/per service/per operation. 同样重要的是要注意,您可以为数据服务分三级进行缓存,即每个服务组/每个服务/每个操作。

A sample services.xml is show below. 下面显示了一个示例services.xml。

<serviceGroup>
    <service name="TestDS">
        <!--parameter name="ServiceObjectSupplier">org.apache.axis2.engine.DefaultObjectSupplier</parameter-->
    <Description>Enabling caching through sevices.xml</Description>

    <operation name="op1">
        <messageReceiver class="org.wso2.carbon.dataservices.core.DBInOutMessageReceiver"/>
    <module ref="wso2caching"/>
        <wsp:Policy
            wsu:Id="WSO2CachingPolicy"
            xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
            xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsch:CachingAssertion xmlns:wsch="http://www.wso2.org/ns/2007/06/commons/caching">
        <wsp:Policy>
            <wsp:All>
            <wsch:XMLIdentifier>org.wso2.caching.digest.DOMHASHGenerator</wsch:XMLIdentifier>
            <wsch:ExpireTime>70000</wsch:ExpireTime>
            <wsch:MaxCacheSize>1000</wsch:MaxCacheSize>
            <wsch:MaxMessageSize>1000</wsch:MaxMessageSize>
            </wsp:All>
        </wsp:Policy>
        </wsch:CachingAssertion>
        </wsp:Policy>
    </operation>

    <operation name="op2">
        <messageReceiver class="org.wso2.carbon.dataservices.core.DBInOutMessageReceiver"/>
    <module ref="wso2caching"/>
        <wsp:Policy
            wsu:Id="WSO2CachingPolicy"
            xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
            xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsch:CachingAssertion xmlns:wsch="http://www.wso2.org/ns/2007/06/commons/caching">
        <wsp:Policy>
            <wsp:All>
            <wsch:XMLIdentifier>org.wso2.caching.digest.DOMHASHGenerator</wsch:XMLIdentifier>
            <wsch:ExpireTime>600000</wsch:ExpireTime>
            <wsch:MaxCacheSize>1000</wsch:MaxCacheSize>
            <wsch:MaxMessageSize>1000</wsch:MaxMessageSize>
            </wsp:All>
        </wsp:Policy>
        </wsch:CachingAssertion>
        </wsp:Policy>
    </operation>
        <operation name="op3">
        </operation>

    </service>
  </serviceGroup>

After placing your "data_service_name"_services.xml file inside the aforesaid directory, you have to comment out the following entry from the axis2.xml configuration file that can be located at "DSS_HOME/repository/conf" directory. 将“ data_service_name” _services.xml文件放置在上述目录中后,必须从“ DSS_HOME / repository / conf”目录中的axis2.xml配置文件中注释掉以下条目。

<listener class="org.wso2.carbon.core.deployment.DeploymentInterceptor">

Now you're good to go with your deployment. 现在您可以进行部署了。 Restart the server and you'll be able to get the aforementioned functionality working. 重新启动服务器,您将能够使上述功能正常运行。

NOTE: You would also want to be informed that a lot of improvements have been done on this space in DSS for our immediate upcoming DSS release. 注意:您还希望了解到,对于我们即将发布的DSS版本,DSS中的该空间已经做了很多改进。 (DSS 3.0.0). (DSS 3.0.0)。

Regards, Prabath 问候,Prabath

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM