繁体   English   中英

托管存储缓存不起作用

[英]Managed Store Cache not working

我的缓存块从不起作用,始终对相同的值发出http请求。

    <ee:object-store-caching-strategy name="eventIdCachingStrategy" doc:name="Autobulk EventID Caching Strategy" keyGenerationExpression="#[flowVars['ablMapEventToListingParameters']]">
       <managed-store storeName="${xyz.eventid.cache.store.name}" persistent="true" maxEntries="${xyz.eventid.cache.max.entries}" entryTTL="${xyz.eventid.cache.entry.timetolive}" expirationInterval="${xyz.eventid.cache.expiration.interval}" />
    </ee:object-store-caching-strategy>

    <sub-flow name="mapEventsForListings" doc:name="mapEventsForListings">
        <logger message="Entering mapEventsForListings flow..." level="INFO" doc:name="Logger"/>
        <set-variable variableName="mapEventsForListingsTimeInMillis" value="#[new java.util.Date().getTime()]" doc:name="Set Entry Time In Millis"/> 
        <foreach doc:name="Map Event ID to each listing">
            <choice doc:name="Choice">
               <when expression="#[payload.getEvent().getVenue().isEmpty() || payload.getEvent().getDate().isEmpty() || payload.getExternalListingId().isEmpty() || payload.getPricePerProduct().getAmount()==0]">
                        <logger message="Missing input data for Payload" level="INFO" doc:name="Listing Missing Data Fields"/>
                        <set-variable variableName="noOfIncompleteListings" value="#[noOfIncompleteListings + 1]" doc:name="Increment Incomplete Listings Error Count"/>
                    </when>
                    <otherwise>
                    <set-variable variableName="ablMapEventToListingParameters" value="/?locale=en_US&amp;venueName=#[payload.getEvent().getVenue()]&amp;eventDateLocal=#[payload.getEvent().getDate()]" doc:name="Autobulk Event Search Parameters"/>
                    <set-variable variableName="originalListingRequest" value="#[payload]" doc:name="Variable"/>
                    <set-payload value="#[null]" doc:name="Set Payload"/>
                    <ee:cache doc:name="Cache" cachingStrategy-ref="eventIdCachingStrategy">
                        <https:outbound-endpoint exchange-pattern="request-response" method="GET" connector-ref="HttpsClientConnector" address="${xyz.search.catalog.events.ship.api.url}#[flowVars['ablMapEventToListingParameters']]" contentType="application/json" doc:name="HTTP Outbound Call to BulkCreateListing API">
                            <message-properties-transformer scope="outbound"> 
                                <add-message-property key="TARGET_HOST" value="${target.host}"/>  
                                <add-message-property key="Authorization" value="#[flowVars['shUserBearerToken']]"/>  
                                <add-message-property key="Content-Type" value="application/json"/> 
                            </message-properties-transformer>
                        </https:outbound-endpoint>
                        <echo-component doc:name="Echo"/>
                    </ee:cache>
</otherwise>
</choice>
</flow>

flowVars ['ablMapToListingParameters']的值= www.api-dev.xyz.com/search/catalog/events/ship/v3/?locale=en_US&venueName=SAPCenter&eventDateLocal=2015-07-16T20:00

尝试使用以下配置:-

<ee:object-store-caching-strategy name="cachingStrategy" doc:name="cachingStrategy">
   <managed-store storeName="myNonPersistentManagedObjectStore" maxEntries="-1" entryTTL="20000" expirationInterval="5000"/>
</ee:object-store-caching-strategy> 

同样,您要在缓存作用域之前将有效负载设置为null……缓存作用域要求有效负载来确定是否可以缓存响应。
对于相同的有效负载,它将进行缓存命中并提供缓存的响应,否则它将处理消息并将其存储在缓存中

参考:-https: //docs.mulesoft.com/mule-user-guide/v/3.7/cache-scope

暂无
暂无

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

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