简体   繁体   English

Mule缓存-到期

[英]Mule Cache - Expiry

How do i setup an expiry time for the cache entries in mule ? 如何设置setup子中的缓存项的到期时间? I am setting up a keyExpression based cache on the incoming requests, like this: 我在传入的请求上设置基于keyExpression的缓存,如下所示:

   <ee:object-store-caching-strategy name="UserAuth-CachingStrategy" keyGenerationExpression="#[message.inboundProperties.'authorization']" doc:name="Caching Strategy">

The cache is supposed to hit an external WS and the results are supposed to be cached for 5 minutes. 缓存应该命中外部WS,结果应该缓存5分钟。 If i set an 'in-memory' store with a TTL for let's say 5 minutes, mule isn't honoring this request. 如果我用TTL设置“内存中”存储时间(假设是5分钟),则m子不接受此请求。 Irrespective of the value in TTL, mule always hits the actual external ws once every 3-4 requests. 不管TTL中的值如何,每3-4个请求,m子都会始终击中实际的外部ws。 If i don't set any value for TTL, then the cache never expires. 如果我没有为TTL设置任何值,则缓存永不过期。 how do i properly set a cache for an 'in-memory' cache in mule ? 我如何为m子中的“内存中”缓存正确设置缓存?

Thanks 谢谢

If you are using ObjectStore , you can easily set as given in the following using spring properties and referring your caching strategy to it :- http://ricston.com/blog/cache-scope-ehcache/ 如果您使用的是ObjectStore,则可以使用spring属性轻松地按以下给定设置,并将缓存策略引用给它: -http : //ricston.com/blog/cache-scope-ehcache/

You can also use managed-store as following :- 您还可以按以下方式使用托管商店:

<ee:object-store-caching-strategy nname="UserAuth-CachingStrategy" keyGenerationExpression="#[message.inboundProperties.'authorization']" doc:name="Caching Strategy">
<managed-store storeName="myNonPersistentManagedObjectStore" maxEntries="-1" entryTTL="20000" expirationInterval="5000"/>
</ee:object-store-caching-strategy>

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

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