---
schema_version: "1"
id: 9d08592d4669355a23cd30f2d1d331489ee852ea50e0e09bca0b979e9dd7946b
title: Configure the Cache Scope
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/mule-runtime/latest/cache-scope-to-configure.md
canonical_url: https://docs.mulesoft.com/mule-runtime/latest/cache-scope-to-configure
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 0c49ef6504480c9b4f1934a99a70726c853c21e72e0d2acd09537a09f9da1558
description: MuleSoft Documentation Site
release: "4.13"
latest: true
---
---
product: Mule Runtime
version: 4.13
is-latest-version: true
---

# Configure the Cache Scope

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

1.  In your Mule app, add a Cache scope to a flow.

2.  Click to open the General tab for the Cache scope.

3.  Configure the Cache scope:

    - Provide a Display Name.

    - Select a Caching Strategy.

      Examples:

      - From the UI: `My_Caching_Strategy`

      - In the Studio XML: `cachingStrategy-ref="My_Caching_Strategy"`

        MuleSoft recommends that you reference a Caching Strategy that uses an ObjectStore instead
        of using the default in a production environment.

        If you need to create a Caching Strategy, see the procedure in [See Also](#see-also).

4.  Opt to set up a filter for specific payloads if you need one.

    Example that uses a DataWeave expression: `filterExpression="#[user.isPremium()]"`

    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 but never saves or produces cached responses.

## Example Cache Scope Configuration

The following example shows the configuration of a Caching Strategy, which is then referenced by a
Cache Scope that contains a Database Select operation and a Transform component:

```xml
<!-- Caching Strategy definition-->
<ee:object-store-caching-strategy name="Caching_Strategy" doc:name="Caching Strategy" />

<!-- The Database Connector config is necessary in this example because there is a Database Select operation-->
<db:config name="Database_Config" doc:name="Database Config" >
    <!-- Database Connector Configuration -->
</db:config>

<!-- Cache Scope configuration referencing the Caching Strategy-->
<ee:cache doc:name="Cache" cachingStrategy-ref="Caching_Strategy">
  <db:select doc:name="Select" config-ref="Database_Config">
    <db:sql >
      <!-- An SQL query-->
    </db:sql>
  </db:select>
  <ee:transform doc:name="Transform Message" >
    <ee:message >
      <ee:set-payload >
        <!-- A DataWeave transformation for the query results -->
      </ee:set-payload>
    </ee:message>
  </ee:transform>
</ee:cache>
```

## See Also

[Set Up a Caching Strategy](https://docs.mulesoft.com/mule-runtime/latest/cache-scope-strategy)

[Cache Scope](https://docs.mulesoft.com/mule-runtime/latest/cache-scope)
