- 25 Oct 2024
- 2 Minutes to read
- Print
- DarkLight
Outcome Caching
- Updated on 25 Oct 2024
- 2 Minutes to read
- Print
- DarkLight
Overview
In contrast to Bespoke Caching via Flow steps, Outcome Caching allows users to store information on the Output/Outcome of a step. Rather than creating a copy for long-term use, Outcome Caches can be configured to hold onto stored data for a set amount of time.
Outcome Caching is particularly useful for users that may need to quickly fetch or make copies of Flow Data easily accessible such as for a Table Integration or when authenticating a Token.
Because the cached output is tied to a specific Step (and this could be a Sub Flow), it is extremely useful for Steps that are resource intensive and are part of Flows that have high volumes of traffic.
Outcome Caching Limitations
Due to the nature of caching the Outcome of a step, information that is cached from steps cannot be fetched via a Get From Cache step. As a result, this cached data cannot be used outside of the Flow for further evaluation or retrieval purposes, and can only exist for the set Cache Timespan.
To access data outside of the origin Flow, users may need to create a Cache Definition and adjust its configuration. The user may also need to write to a Time Cache Definition to access the data.
Also note that each unique step in a flow has its own cache key, even if it is the same kind of step or subflow.
Example
The following example demonstrates how to Cache the Outcome of a Fetch Entities step.
- From a Designer Project, create a new Flow.
- From the Flow Designer, add and configure Fetch Entities step to use the Account datatype.
- Still in the Properties tab, navigate and expand the OUTCOMES category. Then, select the desired setting from the Cache Outcomes dropdown (for this example, PerUser).
Outcome Type Description None No Outcome data is cached Global Caches all outcome data for all Accounts in the environment per Per User Only caches outcome data for the user that executes the step - Set a Cache Timespan by inputting the values into each box, or adjusting the value via the slider. This will determine how long the Outcome data remains within the Cache.
- Save the Flow.
- To confirm this from the Flow Designer, select the Debug link from the top Action Bar. Click START DEBUGGING. After the Flow runs, select Fetch Entities > Execution 1 > View Output Data. The Output Data will remain cached for five minutes.
Custom Cache Key
Rather than use the unique key that is generated by Decisions, a user can set a custom key.
Setting a Cache Key will cause a Step to return the initial cached outcome for the duration of the set timespan. The Step will ignore its inputs on future Flow runs.
In this example a Flow adds two numbers (5000 and 1000) together to get a total of 6000. That total is given a Custom Key and the Output is 6000. When the Flow is run again, the values have changed, the same Custom Key is used, but the Output remains 6000.
To configure, follow steps 1-3 above, and select the Custom Cache Key option and set the Cache Key.