码迷,mamicode.com
首页 > 系统相关 > 详细

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

时间:2016-08-23 12:47:51      阅读:282      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!