Cache Steps

Last Updated: 07/22/2016 Introduced in Verision: 3.2

This tutorial demonstrates how to use Cache Steps in Decisions. With Cache Steps we can store and retrieve some Data values in memory for defined time. In Decisions we are able to define different types of Cache. When we are trying to store some value in Cache, we need to define an Instance of the Cache, its type and a Key to access current Value.

Note: [List] Add Item and [List] Get From Cache steps are explained in the following tutorial: http://decdocs3x.wpengine.com/cache-fetch-flow-behavior/

Example:

In this example we are going to use Cache steps to store the values of the selected row on the Report to use this values on the Form.

For this example we created a simple Report on the Northwind Customers database table.

reportCust

Next, we are going to create a Flow for the Selected Row. In the Designer Folder we click Create Flow on the Folder Actions Panel.

createFlow

In the resulting window we Name the Flow, select Report Selected Row Handler Flow Behavior, and click Create to proceed to the Flow Designer.

createSelectedRowFlow

In the Flow Designer we add Put In Cache step from the All Steps [Catalog] > Data > Cache category.

addPutInCache

Then, we configure data for this Step as following… Define Constant Cache Instance Name (this can be any name that we want to associate with this cache). Constant Cache Type Name (this can be either default decisions cache or our custom cache that is defined in the System > Administration > Cache Folder in the Portal).

defaultCaches

Constant Key for this Value. Finally, we Select Value that we want to store from the Selected Row Fields. In this step we are going to store CustomerId field that will be accessible by ID key in this Cache Instance.

configureFirstPutInCache

Next, we add another Put In Cache step from the All Steps [Catalog] > Data > Cache category.

addSecondPutInCacheStep

We configure this step in the similar manner we configured previous Put In Cache step except this time we define different Key and Value. As a result, we save different Value with different Key in the same Cache.

configuredSecondPutInCache

Then, we add another Put In Cache step from the All Steps [Catalog] > Data > Cache category.

addThirdPutInCache

Again, we configure this step to store our desirable Value with the Key that we can use to access this Value.

configureThirdPutInCache

Finally, we connect steps in our Flow as following. This completes our Cache Flow. We can save the Flow and close Flow Designer.

selectedRowFlowCompleted

Then, we are going to create a Flow that will be using Cached values. In the Designer Folder we click Create Flow on the Folder Actions Panel.

createSecondFlow

In the resulting window we Name the Flow and click Create to proceed to the Flow Designer.

nameSecondFlow

In the Flow Designer we add Get From Cache Step from the All Steps [Catalog] > Data > Cache category. With this step we can access our cached values.

addGetFromCacheStepFirst

We configure this step as following… We define Constant Cache Instance and Type that we created in the first Flow in this tutorial. Then, we define Constant Key of the Value that we need to retrieve from the Cache (in this case it is ID which is a Key for CustomerId value in SelectedCustomer instance of the Default.MemoryCache). Also, we Rename the Result Value output.

configureFirstGetFromCache

Then, we add another Get From Cache Step from the All Steps [Catalog] > Data > Cache category.

addGetFromCacheSecond

We configure this step to get Contact Name Value from the Instance of the Cache that we defined for this tutorial.

configureSecondGetFromCache

Next, we add and configure another Get From Cache Step from the All Steps [Catalog] > Data > Cache category. With this step we are going to get Company Name value from our Cache.

configureThirdGetFromCache

Then, we add a Show Form step from Favorite Steps category.

addShowForm

In the resulting window we Name the Form and click Create to proceed to the Form Designer.

nameForm

On this Form we are going to display our Values from Cache. When we finished Form design we can save the Form and close Form Designer.

formDesign

Back in the Flow Designer we connect the outcome from the Form Step to the End Step. This completes our Display Flow. We save the Flow and close Flow Designer.

DisplayFlowCompleted

Next, we are going to create a Page to display Report and Form. In the Designer Folder we click Create Report/Page > Create Page/Dashboard option on the Folder Actions Panel.

createPage

In the Page Designer we are going to display our Report with Report Viewer component. We are going to Edit Behavior of the Report Viewer.

reportBehavior

Using Selected Row Flow picker we select our Flow that stores Values in Cache.

selectFlowForRow

Then, with Flow Run Part component we are going to add our Display Flow to the Page. This completes our Page Design. We save our Page and close Page Designer.

addFlowToPage

In the Designer Folder we add our Page as a view for the Folder.

displayExistingPage

When the Page is displayed, our Form displays values from the first row in the Report.

pageRunsFirst

Then, we select different Row on the Report and click Refresh on the Form.

selectRowAndRefresh

Our Form reloads and displays new cached values from the current selected row on the Report.

refreshed

Cache Steps that are not covered in this tutorial:

Clear Cache: Clear desired Instance in Cache (in this tutorial it would be SelectedCustomer instance of the Default.MemoryCache)

Key Exist In Cache: check if the Instance of the Cache contains the Key (in this tutorial we had ID, CONTACTNAME, and COMPANYNAME keys)

Put In Cache [generated key]: With this step we can put the Value in our Cache and the step generates and outputs a Key to access this value.

Remove Key From Cache: Removes the Value from our Cache instance by Key.

Additional Resources