◷ Reading Time: 4 minutes

Caching enables your model to store some data in memory and keep it for a period of time. When Caching is enabled as part of orchestration models (i.e. Flow and Workflow) the steps will be executed only if the Cache is not available, otherwise, the execution of steps with enabled cache returns the stored values from the memory rather than executing the steps.

Caching is available for the below steps from your orchestration toolbox:

  • File
  • REST API call
  • Excel Spreadsheet
  • Database

There are two options available to manage how long a cached value remains active.

  1. Cache without expiry
  2. Expire cache based on a time

Note the expired cached values still remain in memory and consued memory. If you need to cleanup cache you can use cacheRemove function.

Sample Caching Scenario

When you read some static information from a data souce, you don’t need to read and access IO for every request. You can use the Caching settings of data source to ensure the results are cached for the first time and will be reused for subsequent requests.

Add a cache key for the data source

Key : Cache Key is used to reference the data that will be stored in memory. If not set, caching is disaled, otherwise you can give a string value to represent the key.

You can define your own cache key.

Cache Key should be a unique string value that holds the value in the memory. For example 1d915d77-eb2d-4c17-b18b-a2d397ec16ba

If Cache Key is not defined, the values will not be cached.

To generate a Cache Key you can open the Key editor from Properties Window, and at the toolbar of the editor there is a Generate button.

Generator to create a unique Cache Key

Add Expiry

Expiry : Set a value to enable caching based on operating system’s process life cycle. Value can be ‘never’ which cache will not be expired. Or else you can set a time using the interface.

Select the Properties Window, and click on the Expiry editor. You can choose a caching expiry options as below:

Once the caching option is selected for expiry the value will be updated.

Now when you run the project the data will be cached and can be accessed using the key.

Set Cache as an Execution Event

You can set a cache as an execution event for a database or REST API.

Key and Expiry will be the same as explain above.

Managing Cached Items

You can alterenatively use Cache Inspector UI for managing the Cache.

Read Cached Items

You can use cacheList() function in the Watch window to see the list of cache values.

Remove Cached Items

You can use cacheRemove(<key>) function in the Watch window to remove an existing cache.

To access the detailed expression list for cache management, click here.

Sample Project

See the attached sample project.

Updated on October 27, 2023

Article Attachments

Was this article helpful?

Related Articles