STUDIO Visual Editor
-
Drag and drop the cache scope icon from the palette into a flow on your canvas.
-
Drag one or more building blocks from the palette into the cache scope to build a chain of processors to which Mule will apply the caching strategy. A cache scope can contain any number of message processors.
-
Open the building block’s Scope Properties panel, then configure the fields per the table below.
Field | Value | Description | XML |
---|---|---|---|
Display Name |
Cache |
Customize to display a unique name for the scope in your application. |
|
Caching strategy reference |
Use Default caching strategy |
(Default) Select if you want the cache scope to follow Mule’s default caching strategy. |
N/A |
Reference to a strategy |
Select to configure the cache scope to follow a global caching strategy that you have created; select the global caching strategy from the drop-down menu or create on by clicking the . |
|
|
Filter |
Process all messages |
(Default) Select if you want the cache scope to execute the caching strategy for all messages that enter the scope. |
N/A |
Filter messages using an expression |
Selecet if you want the cache scope to execute the caching strategy ONLY for messages the match the expression(s) defined in this field. If the message matches the expression(s), Mule executes the caching strategy. If the message does not match expression(s), Mule processes the message through all message processors within the cache scope; Mule never saves nor offers cached responses. |
|
|
Filter messages using a global filter |
Select if you want the cache scope to execute the caching strategy only for messages that successfully pass through the designated global filter. If the message passes through filter, Mule executes the caching strategy. If the message fails to pass through filter, Mule processes the message through all message processors within the cache scope; Mule never saves nor offers cached responses. |
|
XML Editor or Standalone
-
Add a
ee:cache
element to your flow at the point where you want to initiate a cache processing block. Refer to the code sample below. -
Optionally configure the scope according to the tables below.
Element Description ee:cache
Use to create a block of message processor that will process a message, deliver the output to the parent flow, and cache the response for reuse (according to the rules of the caching strategy.)
Element Attribute Default Value Description doc:name
Cache
Customize to display a unique name for the cache scope in your application.
Note: Attribute not required in Mule Standalone configuration.
filterExpression
(Optional) Specify one or more expressions against which the cache scope should evaluate the message to determine whether the caching strategy should be executed.
filter-ref
(Optional) Specify the name of filtering strategy that you have defined as a global element. This attribute is mutually exclusive with filterExpression.
cachingStrategy-ref
(Optional) Specify the name of the global caching strategy that you have defined as a global element. If no
cachingStrategy-ref
is defined, Mule will use default caching strategy. -
Add nested elements beneath your
ee:cache
element to define what processing should occur within the scope. The cache scope can contain any number of message processors as well as references to child flows.<ee:cache doc:name="Cache" filter-ref="Expression" cachingStrategy-ref="Caching_Strategy"> <some-nested-element/> <some-other-nested-element/> </ee:cache>