---
schema_version: "1"
id: 285f356d2bebac6f63d86010f56ab9de2effe339588da99a04ba5d942a1be638
title: Create a Cache Block Example
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_create_a_cache_block_example_48989.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_create_a_cache_block_example_48989.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 4e3f6ad2a82ff2063f3b1636e110b4a59df274c23ddc01fccd0bf063f8b7b0f0
description: In this example, an Integration Procedure accepts a list of first or last names and retrieves Contacts having those names. A Cache Block improves Contact retrieval performance.
products:
  - Omnistudio
release: "264"
---
# Create a Cache Block Example

In this example, an Integration Procedure accepts a list of first or last names and retrieves Contacts having those names. A Cache Block improves Contact retrieval performance.

In this example, the Integration Procedure has these components:

- A Cache Block, named CacheBlock1
- A Loop Block within the Cache Block, named LoopBlock1
- An Omnistudio Data Mapper Extract Action within the Loop Block, named ExtractContact
- A Response Action, named ResponseAction

To build this Integration Procedure:

1. Create an Integration Procedure.
2. Add a Cache Block component:
    - To open the Elements panel, click **+**, select **Cache Block**, click ![Three dots](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/omnistudio/images/threedots_60.png), and select **Details**.
    - If you’re using the designer on a managed package, open the Available Components panel, and drag **Cache Block** to the Structure panel.
3. Configure the Cache Block component with these settings:
    
    <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col>
              <col>
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d57358e116">
                  <p style="margin-bottom:0;">Property</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d57358e122">
                  <p style="margin-bottom:0;">Value</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e116 ">
                  <p style="margin-bottom:0;">Salesforce Platform Cache Type</p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e122 ">
                  <p style="margin-bottom:0;">Org Cache</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e116 ">
                  <p style="margin-bottom:0;">Time To Live In Minutes</p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e122 ">
                  <p style="margin-bottom:0;">5</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e116 ">
                  <p style="margin-bottom:0;">Cache Keys</p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e122 "><a name="os_create_a_cache_block_example_48989__ul_j3p_fdf_gcc"><!-- --></a>
                  <ul id="os_create_a_cache_block_example_48989__ul_j3p_fdf_gcc">
                    <li>Key: <code>contactId</code>
                    </li>

                    <li>Value: <code>%ExtractContact:Contact:Id%</code></li>

                  </ul>
                  <a name="os_create_a_cache_block_example_48989__ul_lw1_3df_gcc"><!-- --></a>
                  <ul id="os_create_a_cache_block_example_48989__ul_lw1_3df_gcc">
                    <li>Key: <code>contactName</code>
                    </li>

                    <li>Value: <code>%ExtractContact:Contact:Name%</code></li>

                  </ul>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e116 ">
                  <p style="margin-bottom:0;">Cache Block Output</p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e122 "><a name="os_create_a_cache_block_example_48989__ul_usk_kdf_gcc"><!-- --></a>
                  <ul id="os_create_a_cache_block_example_48989__ul_usk_kdf_gcc">
                    <li>Key: <code>LoopBlock1</code>
                    </li>

                    <li>Value: <code>%LoopBlock1%</code></li>

                  </ul>
                </td>

              </tr>
            </tbody>
          </table>
4. Add a Loop Block inside the Cache Block and configure it with these settings:
    
    <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col>
              <col>
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d57358e250">
                  <p style="margin-bottom:0;">Property</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d57358e256">
                  <p style="margin-bottom:0;">Value</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e250 ">
                  <p style="margin-bottom:0;">Loop List</p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e256 ">
                  <p style="margin-bottom:0;">names</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e250 ">
                  <p style="margin-bottom:0;">Additional Loop Output</p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e256 "><a name="os_create_a_cache_block_example_48989__ul_bjk_ndf_gcc"><!-- --></a>
                  <ul id="os_create_a_cache_block_example_48989__ul_bjk_ndf_gcc">
                    <li>Key: <code>ExtractContact</code>
                    </li>

                    <li>Value: <code>%ExtractContact%</code></li>

                  </ul>
                </td>

              </tr>
            </tbody>
          </table>
5. Create a Data Mapper Extract that the Data Mapper Extract Action calls, and configure it with these settings:
    
    <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col>
              <col>
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d57358e329">
                  <p style="margin-bottom:0;">Tab</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d57358e335">
                  <p style="margin-bottom:0;">Settings</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Tab" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e329 ">
                  <p style="margin-bottom:0;">Extract</p>
                </td>

                <td data-label="Settings" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e335 ">
                  <p style="margin-bottom:0;">A Contact extract step set to&nbsp;<code>Contact
                                    Name LIKE name</code>
                  </p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Tab" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e329 ">
                  <p style="margin-bottom:0;">Output</p>
                </td>

                <td data-label="Settings" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e335 ">
                  <p>A mapping from <code>Contact:Id</code> to
                    <code>Contact:Id</code>
                  </p>
                  <p style="margin-bottom:0;">A mapping from <code>Contact:Name</code> to
                    <code>Contact:Name</code>
                  </p>
                </td>

              </tr>
            </tbody>
          </table>
    
    To create a Data Mapper Extract, see the examples in [Omnistudio Data Mapper Extract Examples](https://help.salesforce.com/s/articleView?id=xcloud.os_dataraptor_extract_examples_46190.htm&release=264.0.0&type=5 "Data Mapper Extract examples demonstrate object relationships, paging with data values, paging with offsets, and relationship notation.").
6. Add a Data Mapper Extract Action inside the Loop Block, and configure it with these settings:
    
    <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col>
              <col>
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d57358e426">
                  <p style="margin-bottom:0;">Property</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d57358e432">
                  <p style="margin-bottom:0;">Value</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e426 ">
                  <p style="margin-bottom:0;">Element Name</p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e432 ">
                  <p style="margin-bottom:0;">ExtractContact</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e426 ">
                  <p style="margin-bottom:0;">Data Mapper Interface</p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e432 ">
                  <p style="margin-bottom:0;">ExtractContactName</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e426 ">
                  <p style="margin-bottom:0;">Data Source</p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e432 ">
                  <p style="margin-bottom:0;">names:name</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e426 ">
                  <p style="margin-bottom:0;">Filter Value</p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e432 ">
                  <p style="margin-bottom:0;">name</p>
                </td>

              </tr>
            </tbody>
          </table>
7. Add a Response Action below the Loop Block, and configure it with these settings:
    
    <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col>
              <col>
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d57358e524">
                  <p style="margin-bottom:0;">Property</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d57358e530">
                  <p style="margin-bottom:0;">Value</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e524 ">
                  <p style="margin-bottom:0;">Send JSON Path</p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d57358e530 ">
                  <p style="margin-bottom:0;">CacheBlock1</p>
                </td>

              </tr>
            </tbody>
          </table>
8. Click **Edit as JSON**. If you’re using the designer on a managed package, click **Preview**, and then click **Edit as JSON**.
9. Copy this JSON data and paste it into the Input Parameters panel:
    
    ```
    {
        "names": [
            {
                "name": "Miller"
            },
            {
                "name": "Torres"
            }
        ]
    }
    ```
    
    To demonstrate performance most effectively, specify common and/or many names.
10. Click **Execute** and note the resulting Browser, Server, and Apex CPU values.
11. Open the Options pane and change the `ignoreCache` value to `false`.
12. Click **Execute**. This step populates the cache, so the resulting Browser, Server, and Apex CPU values should be similar to the previous values.
13. Click **Execute**. This step uses the cached values, so the resulting Browser, Server, and Apex CPU values should be noticeably less than the previous values.
14. To see the `vlcCacheKey` and `vlcCacheResult` nodes, open the Debug Log and scroll to the `CacheBlock1Info` node.