◷ Reading Time: 3 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:
- REST API call (Get Verb only)
- Excel Spreadsheet
There are two options available to manage how long a cached value remains active.
- Cache without expiry
- Expire cache based on a time
Sample Caching Scenario
When you read some static information from a file, you don’t need to read and access IO for every request. You can use the Caching settings of File to ensure the results are cached for the first time and will be reused for subsequent requests.
1. To start, create a Flow as below model. Add a File node to read a file.
2. Add a cache key
Cache Key should be a unique string value that holds the value in the memory. For example
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.
3. Add Expiry
Select the Properties Window, and click on the Expiry editor. You can choose a caching option as below:
Once the caching option is selected for expiry the value will be updated.
4. Now when you run the project the data will be cached and can be accessed using the key.
Managing Cached Items
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.
See the attached sample project.