Cache Fetch Flow Behavior

Last Updated: 10/17/2018 Introduced in Version: 3.2

This tutorial demonstrates how to use Cache Fetch Flow Behavior. This Flow Behavior can be used to fill the cache in with data that needs to be kept for a certain time. Additionally, this tutorial demonstrates how to get a collection of data from cache.

 

Steps:

  • GetAll: Integrations > Internal Services > Account Services
  • [List] Get From Cache: Data > Cache 

 

Below is a picture of the second completed flow. In this example Cache a collection of Account Emails. Next, this Flow will fill a custom created Cache Type. Finally, a second flow will get all items from the custom Cache Type.

 

Begin in the Designer Folder and select Create Flow on the Folder Actions Panel, name the Flow select create.

In the Flow Designer define the Behavior as Cache Fetch Flow Behavior. 

 

Configure the Steps:

GetAll

From the start step add the GetAll step from Integrations > Internal Services > Account Services. Connect the outcome path to Cache Value.

 

Cache Value

Configure this step to take in the Account Email Addresses. Select Show Editor under Data > Output. Define the Data Name as Value then the Data Type as System.Object

Under Inputs > Value chose Select From Flow then Pick: GetAll_Output.All Email Address

Save and Close the Flow Designer.

 

Define Cache Type:

Navigate to System > Administration > Cache. Then, from the Folder Actions Panel select Add > TimeCacheDefinition.

In the Edit Time Cache Definition dialog check Fill Cache Using Flow. Then, select the flow the was previously created in this example for the Cache Fill Flow.

Name the Cache in the Configuration Name field. From the Target Cache Config Name drop-down list chose Default.MemoryCache.

Finally, with the Check On Interval Span, define life cycle for the Cache. Select SAVE to save Cache definition.

Confirm that the Cache was successfully saved in the Cache Folder and is ready for use.

 

Second Flow

Create a simple Flow to test if the Cache is filled in with the Flow For Cache and if it is able to retrieve cached Emails. Navigate to the Designer Folder and select Create Flow on the Folder Actions Panel. Next, Name the Flow and select Create to proceed to the Flow Designer.

 

[List] Get From Cache

Add [List] Get From Cache step from the All Steps [Catalog] > Data > Cache category. Configure data mapping as following. First, provide CacheName and from the CachTypeName drop down select the custom Cache that was created previously. Then define the Constant Value for the Key Input.

 

This completes the Flow. Select Debug on the top panel of the Flow Designer to test the Flow.

In the Debugger the Flow executes to the End step with no issues. Observe Data Flows in the Flow. Select [List] Get From Cache step and check what Data outcomes from it. This is a list of Account Emails.

 

Additional Resources