Contact Us 1-800-596-4880

Set Up a Caching Strategy

Standard Support for Mule 4.1 ended on November 2, 2020, and this version of Mule reached its End of Life on November 2, 2022, when Extended Support ended.

Deployments of new applications to CloudHub that use this version of Mule are no longer allowed. Only in-place updates to applications are permitted.

MuleSoft recommends that you upgrade to the latest version of Mule 4 that is in Standard Support so that your applications run with the latest fixes and security enhancements.

You can create a Caching Strategy from a Cache scope or from a Global Elements configuration in Anypoint Studio. Once you create a strategy, a Cache component in your flow can reference it.

  1. Open the Caching Strategy configuration window.

    You can open it from the Cache component configuration tab or from the Caching Strategies option in the Global Elements tab within Studio.

  2. Provide a Name for your Caching Strategy.

  3. Reference an ObjectStore or create one for your Cache component to reference.

  4. Select a mechanism for generating a key used for storing events within the Caching Strategy:

    • Default

    • Key Expression: A DataWeave expression (for example, keyGenerationExpression="#[vars.requestId]").

      Note that for two requests that are the same ("equal"), you need to generate the same key. Otherwise, you can get wrong results.

    • Key Generator: Requires you to implement the com.mulesoft.mule.runtime.cache.api.key.MuleEventKeyGenerator interface.

  5. Perform any optional steps that you need.

    • Select or create a Response Generator.

      Note that this step requires that you implement the com.mulesoft.mule.runtime.cache.api.response.ResponseGenerator interface.

    • Change the Event Copy Strategy from Simple (the default, where data is immutable) to Serializable (where data is mutable).