---
schema_version: "1"
id: 967505f840c2833534c07dad856241a453ba760a3b29e34d5bf75385aa11a362
title: Enhance Performance by Using Cache Blocks
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_enhance_performance_using_cache_blocks_48810.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_enhance_performance_using_cache_blocks_48810.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 34636dd5b6fe8eb34ec97eed3b58337846a8ea6276a86438b2906f2f09f2e7bf
description: Use Cache Blocks if some parts of the Integration Procedure update data, or if you need different cached data to expire at different times. For example, current weather data changes more frequently than user session data.
products:
  - Omnistudio
release: "264"
---
# Enhance Performance by Using Cache Blocks

Use Cache Blocks if some parts of the Integration Procedure update data, or if you need different cached data to expire at different times. For example, current weather data changes more frequently than user session data.

It's important to understand how top-level Integration Procedure caching interacts with Cache Blocks. See [Improving Data Mapper Performance with Caching](https://help.salesforce.com/s/articleView?id=xcloud.os_cache_for_dataraptors_and_integration_procedures_48057.htm&release=264.0.0&type=5 "Omnistudio offers multiple caching options to improve performance and minimize unnecessary data processing in Data Mappers. The two primary user-configurable caching types are Org Cache and Session Cache, which are available in the Data Mapper designer. These caching mechanisms are part of the Salesforce Platform Cache and are implemented through Scale Cache in Omnistudio with standard runtime. Each serves a distinct purpose and comes with specific configuration considerations.").

A Cache Block saves the output of the steps within it to a session or org cache in the VlocityAPIResponse cache partition for quick retrieval.

## Test Options for Cache-Block Caching in Preview

When you test an Integration Procedure that includes a Cache Block in the Preview tab, you can use two caching settings in the Options JSON section. These settings also affect top-level caching but have no effect on the metadata cache.

- `ignoreCache` — Doesn't clear or save data to the cache. The default value is `true`. Use this setting to test Integration Procedure steps without the possible interference of caching effects.
- `resetCache` — Forces data to be saved to the cache. The default value is `false`. Use this setting as part of testing caching itself.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_note.png)

Note

To test caching, be sure to set `ignoreCache` to `false`. See [Create a Cache Block Example](https://help.salesforce.com/s/articleView?id=xcloud.os_create_a_cache_block_example_48989.htm&release=264.0.0&type=5 "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.").

You can pass ignoreCache and resetCache as parameters when you invoke an Integration Procedure that uses caching using a REST API. For example, you can include `?resetCache=true` in the URL to force caching. See [Integration Procedure Invocation from REST APIs](https://help.salesforce.com/s/articleView?id=xcloud.os_integration_procedure_invocation_from_rest_apis_55792.htm&release=264.0.0&type=5 "With a REST API, you can use either a GET or a POST call to invoke an Integration Procedure and retrieve the result. The difference between the two is that a GET call can't pass data with a JSON request body.").

## Cache Block JSON Nodes

An active Integration Procedure that uses a Cache Block can include the following JSON nodes in its Debug Log output, which is visible on the Preview tab:

- `vlcCacheKey` — Key for any data stored in the cache
- `vlcCacheResult` — Included and set to true if data is retrieved from the cache
- `vlcCacheEnabled` — Included and set to false if the `ignoreCache` setting disables caching
- `vlcCacheException` — Any caching errors

These nodes are under the `Info` node for the Cache Block. For example, if the Cache Block is named CacheBlock1, these nodes are under the `CacheBlock1Info` node.

## Apex Methods to Clear Cache Block Data

If you must clear Cache Block data from the cache, follow the instructions in [Fix the DataPack Import or Export Error: No Configuration Found](https://help.salesforce.com/s/articleView?id=xcloud.os_fix_the_datapack_import_export_error_no_configuration_found.htm&type=5&language=en_US), but execute one of these lines of code instead:

```
IntegrationProcedureService.clearSessionCache('Type_Subtype', 'blockName', new Map<String, Object>{'key' => 'value'});

IntegrationProcedureService.clearOrgCache('Type_Subtype', 'blockName', new Map<String, Object>{'key' => 'value'});

IntegrationProcedureService.clearSessionCache('vlcCacheKey');

IntegrationProcedureService.clearOrgCache('vlcCacheKey');
```

You can clear all cached data for an Integration Procedure, including session cache data, org cache data, and metadata. Follow the instructions in [Fix the DataPack Import or Export Error: No Configuration Found](https://help.salesforce.com/s/articleView?id=xcloud.os_fix_the_datapack_import_export_error_no_configuration_found.htm&type=5&language=en_US), but execute this line of code instead, specifying the Integration Procedure's Type and Subtype:

```
IntegrationProcedureService.clearAllCache('Type_Subtype');
```

For example, execute this code if:

- You want to clear a Cache Block key in the Org Cache
- The Type\_Subtype parameter for the Integration Procedure is LastNames\_Cached
- The Cache Block is named CacheContacts
- The cache key you want to clear is ContactLastName
- The key's value is Smith

```
IntegrationProcedureService.clearOrgCache('LastNames_Cached', 'CacheContacts', new Map<String, Object>{'ContactLastName' => 'Smith'});
```

The following example clears the session cache using a vlcCacheKey value:

```
IntegrationProcedureService.clearSessionCache('2032076016a1745801061oc');
```

- **[Create a Cache Block Example](https://help.salesforce.com/s/articleView?id=xcloud.os_create_a_cache_block_example_48989.htm&release=264.0.0&type=5)**  
    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.