首页 > 系统服务 > 详细

工作框架各种使用整理---使用Cache

时间:2016-08-23 12:46:57      阅读:259      评论:0      收藏:0      [点我收藏+]
<service verb="get" noun="Products">
        <implements service="sang.product.ProductServices.get#ProductsWithPagination"/>
        <in-parameters>
            <parameter name="productCategoryId" required="true"/>
            <parameter name="geoId" required="true"/>
            <parameter name="level" type="Integer" default-value="1"/>
        </in-parameters>
        <actions>
            <set field="cacheKeyName" from="productCategoryId + ‘_‘ + level + ‘_‘ + geoId + ‘_‘ + pageIndex + ‘_‘ + pageSize + ‘_‘ + pageNoLimit + ‘_‘ + orderByField"/>
            <script>
                def categoryGeoProductCache = ec.cache.getCache(‘Product_List_By_Category_Geo‘)
                productList = (List) categoryGeoProductCache.get(cacheKeyName)
            </script>
            <if condition="productList != null"><return/></if>
            <service-call name="sang.moqui.extend.BasicServices.get#ChildGeoIds" in-map="[ geoId: geoId, level: 20 ]" out-map="context"/>
            <set field="geoIds" from="geoIds + [geoId]"/>
            <service-call name="sang.product.CategoryServices.get#ChildProductCategoryIds" out-map="context"
                in-map="[ productCategoryId: productCategoryId, level: level ]"/>

            <set field="paginateMap" from="[pageIndex: pageIndex, pageSize: pageSize, pageNoLimit: pageNoLimit, orderByField: orderByField]"/>
            <entity-find entity-name="sang.product.ProductAndCategoryAndGeo" list="pList" distinct="true" cache="true">
                <search-form-inputs input-fields-map="paginateMap"/>
                <date-filter/>
                <econdition field-name="statusId" value="ProductOnShelf"/>
                <econdition field-name="geoId" operator="in" from="geoIds"/>
                <econdition field-name="productCategoryId" operator="in" from="productCategoryIds"/>
                <select-field field-name="productId"/>
            </entity-find>

            <service-call name="sang.product.ProductServices.get#ProductsByIds" in-map="[productIds: pList.productId]" out-map="context"/>
            <service-call name="sang.common.CommonServices.add#PaginateResponseHeaders"
                in-map="[ pageIndex: pageIndex, pageSize: pageSize, totalCount: pListCount, pageMaxIndex: pListPageMaxIndex,
                          pageRangeLow: pListPageRangeLow, pageRangeHigh: pListPageRangeHigh ]"/>
            <script>
                categoryGeoProductCache.put(cacheKeyName, productList)
            </script>
        </actions>
    </service>

 

工作框架各种使用整理---使用Cache

原文:http://www.cnblogs.com/dream-to-pku/p/5798551.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!