---
schema_version: "1"
id: a8e945e410b352bad91bcdb1c89fb6b155dea13c5e75d52d959007e0a302fe5e
title: Create a Cache Block Example (Managed Package)
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.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_create_a_cache_block_example.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: f9a343499d20771b485fa32bf2cfa01ff9b7294bc04b14b9b8244733a9018ccf
description: For the managed package runtime, 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 (Managed Package)

For the managed package runtime, an Integration Procedure accepts a list of first or last names and retrieves Contacts having those names. A Cache Block improves Contact retrieval performance.

![Managed Package app icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/resources-global/_corporate/images/managedpackageicon.png) This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see [Omnistudio Help](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_standard.htm&language=en_US).

This Integration Procedure also includes a Loop Block; see [Process Arrays Using Loop Blocks (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_process_arrays_using_loop_blocks.htm&release=264.0.0&type=5 "For the managed package runtime, a Loop Block iterates over the items in a data array, enabling the Actions within it to repeat for each item. For example, in ​Salesforce Industries Communications, Media, and Energy, without a Loop Block, adding four products to a cart would require running four separate Remote Actions. But one Remote Action within a Loop Block can add all four products.").

To download a data pack of this example for Omnistudio for Managed Packages, click [here](https://volt.my.salesforce.com/sfc/p/o0000000IKm8/a/3m0000005uKM/n0ldOASmavmKkjIaKbOcJqby11yfWIdd4G8FioNW8ZU).

This 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

The Structure panel looks like this:

![The contents of the Structure panel are listed in the preceding text.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/omnistudio_for_managed_packages/images/cacheblockstructure.png)

To build this Integration Procedure:

1. From the Integration Procedures tab, click **New**.
2. Provide an **Integration Procedure Name**, a **Type**, and a **SubType**, and click **Save**.
3. Drag a Cache Block into the Structure panel and give it the following 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="d276363e147">
                  <p style="margin-bottom:0;">Property</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d276363e153">
                  <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="d276363e147 ">
                  <p style="margin-bottom:0;">Salesforce Platform Cache Type</p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d276363e153 ">
                  <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="d276363e147 ">
                  <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="d276363e153 ">
                  <p style="margin-bottom:0;">5</p>
                </td>

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

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d276363e153 ">
                  <p><code>contactId</code> set to <code>%ExtractContact:Contact:Id%</code>
                  </p>
                  <p style="margin-bottom:0;"><code>contactName</code> set to <code>%ExtractContact:Contact:Name%</code>
                  </p>
                </td>

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

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d276363e153 ">
                  <p style="margin-bottom:0;"><code>LoopBlock1</code> set to <code>%LoopBlock1%</code>
                  </p>
                </td>

              </tr>
            </tbody>
          </table>
4. Drag a Loop Block inside the CacheBlock and give it the following 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="d276363e263">
                  <p style="margin-bottom:0;">Property</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d276363e269">
                  <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="d276363e263 ">
                  <p style="margin-bottom:0;">Loop List</p>
                </td>

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

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

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

              </tr>
            </tbody>
          </table>
5. Create the Data Mapper Extract that the Data Mapper Extract Action calls, name it ExtractContactName, and give it the following 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="d276363e336">
                  <p style="margin-bottom:0;">Tab</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d276363e342">
                  <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="d276363e336 ">
                  <p style="margin-bottom:0;">Extract</p>
                </td>

                <td data-label="Settings" class="slds-cell-wrap" style="vertical-align:top;" headers="d276363e342 ">
                  <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="d276363e336 ">
                  <p style="margin-bottom:0;">Output</p>
                </td>

                <td data-label="Settings" class="slds-cell-wrap" style="vertical-align:top;" headers="d276363e342 ">
                  <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>
    
    If you aren't sure how to create a Data Mapper Extract, see the examples in [Omnistudio Data Mapper Extract Examples (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_dataraptor_extract_examples.htm&release=264.0.0&type=5 "For the managed package runtime, Data Mapper Extract examples demonstrate object relationships, paging with data values, paging with offsets, working with attributes, and relationship notation.").
6. Drag a Data Mapper Extract Action inside the Loop Block and give it the following 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="d276363e433">
                  <p style="margin-bottom:0;">Property</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d276363e439">
                  <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="d276363e433 ">
                  <p style="margin-bottom:0;">Element Name</p>
                </td>

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

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

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

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

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d276363e439 ">
                  <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="d276363e433 ">
                  <p style="margin-bottom:0;">Filter Value</p>
                </td>

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

              </tr>
            </tbody>
          </table>
7. Drag a Response Action below the Loop Block and give it the following 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="d276363e531">
                  <p style="margin-bottom:0;">Property</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d276363e537">
                  <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="d276363e531 ">
                  <p style="margin-bottom:0;">Send JSON Path</p>
                </td>

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

              </tr>
            </tbody>
          </table>
8. To test this Integration Procedure, on the Preview Tab, click **Edit as JSON** and provide input with the following structure:
    
    ```
    {
        "names": [
            {
                "name": "Miller"
            },
            {
                "name": "Torres"
            }
        ]
    }
    ```
    
    To demonstrate performance most effectively, specify common and/or many names.
9. Click **Execute** and note the resulting Browser, Server, and Apex CPU values.
10. Open the Options pane and change the `ignoreCache` value to `false`.
    
    ![Under Errors/Debug Output are the Debug Log, errors, and Options panes. The Options pane is expanded to reveal resetCache, ignoreCache, and other options.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/omnistudio_for_managed_packages/images/cachingpreviewoptions.png)
11. Click **Execute** again. This step populates the cache, so the resulting Browser, Server, and Apex CPU values should be similar to the previous values.
12. Click **Execute** a third time. This step uses the cached values, so the resulting Browser, Server, and Apex CPU values should be noticeably less than the previous values.
13. To see the `vlcCacheKey` and `vlcCacheResult` nodes, open the Debug Log and scroll to the `CacheBlock1Info` node.
    
    ![Under Errors/Debug Output, the Debug Log pane is expanded. JSON data for CacheBlock1 is displayed, including vlcCacheResult and vlcCacheKey.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/omnistudio_for_managed_packages/images/cachekeyresponse.png)