2017-01-30 38 views

回答

1

默認情況下,發生器提供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默認爲