0
我正在使用Anypoint Studio 6.1和Mule 3.8.1,並有一個使用默認事件密鑰生成的管理存儲高速緩存策略。如何從Mule獲取高速緩存事件密鑰
如何在流中獲取此密鑰的值?它存儲在哪裏?
感謝
我正在使用Anypoint Studio 6.1和Mule 3.8.1,並有一個使用默認事件密鑰生成的管理存儲高速緩存策略。如何從Mule獲取高速緩存事件密鑰
如何在流中獲取此密鑰的值?它存儲在哪裏?
感謝
默認情況下,發生器提供SHA 256 hash
作爲重點,如果你不提供緩存密鑰生成器的表達。
REF: - https://github.com/mulesoft/mule/blob/mule-3.x/core/src/main/java/org/mule/keygenerator/SHA256MuleEventKeyGenerator.java
這發生器計算當前消息字節的有效載荷的SHA 256 hash
。
您可以使用下面的例子讓你流的緩存鍵的列表: -
<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>
<flow name="keylist" doc:name="keylist">
<http:listener config-ref="HTTP_Listener_Configuration" path="/getkeyvalue" doc:name="HTTP"/>
<scripting:component doc:name="Initialise Database">
<scripting:script engine="Groovy">
<scripting:text><![CDATA[
def keyValues = [];
for(a=0;a<muleContext.getRegistry().lookupObject("cachingStrategy").getStore().allKeys().size();a++)
{
keyValues = muleContext.getRegistry().lookupObject("cachingStrategy").getStore().allKeys().get(a);
}
if(keyValues.isEmpty())
{
return "Key is either null or expired !!!";
}
else
{
return "KeysList " + muleContext.getRegistry().lookupObject("cachingStrategy").getStore().allKeys().toString();
}
]]></scripting:text>
</scripting:script>
</scripting:component>
</flow>
每當你把一些消息緩存,使用上述流程,你可以得到的所有列表默認緩存鍵值緩存範圍提供爲SHA 256 hash
默認爲