- 23 Jan 2025
- 5 Minutes to read
- Print
- DarkLight
Cache Steps
- Updated on 23 Jan 2025
- 5 Minutes to read
- Print
- DarkLight
Overview
With Cache Steps, users can store and retrieve data values in memory for a defined time. In Decisions, there is the ability to define different types of Cache. While trying to store some value in Cache, define an Instance of the cache, cache type, and a key to access the current value. Because of the custom nature of this set-up, this is referred to as "Bespoke Caching".
Before using Cache steps within a Project, make sure to set Cache Instances and Cache Definitions.
Put in Cache
- In a Project, navigate to Manage > Configuration > Cache and click ADD. Select MemoryCacheDefinition.
- From the MemoryCacheDefinition window, provide the desired Configuration Name and Description. Click SAVE.
- Next click ADD CACHE INSTANCE. Write a Cache Name and select a cache definition in the dropdown list under Configuration. A cache instance is required for the cache steps to work correctly.
- From a Designer Folder, select CREATE FLOW from the Global Action Bar. Select Flow, name the Flow, and click CREATE.
- On the Toolbox panel, navigate to SYSTEM > CACHING and attach a Put In Cache step to the Start and End steps.
- On the Properties panel, pick "MemoryCacheInstance" in the Cache Name dropdown list.
- Enter "1" in the Key field and "admin@decisions" Value. Additional Info on KeyThe Key Input is used as an identifier for the Value being placed in the Cache. It is used to both organize the Value in the Cache and can be used to later locate and pull the Cache via additional steps.
- Click Save to save changes to the Flow. Click Debug from the top action bar. Click START DEBUGGING.
- After the Flow runs, select the Put In Cache step. Click Execution 1 and select View Input/Output Data to verify that the value was stored in the Cache.
Get From Cache
The following example demonstrates how to pull an email address from an email cache via a Flow.
- In a Designer Project, click CREATE FLOW. Select Flow, name the Flow, and click CREATE.
- In the Flow Designer, attach a Get From Cache step from the Toolbox panel under SYSTEM > CACHING to the Start and End steps.
- From the Properties tab of the Get From Cache step, select the Cache Name, and enter, as a constant, the Key that were used to place the value in the Cache.
- Click Save to save changes to the Flow. Click the Debug on the top action bar, then click START DEBUGGING.
- After the Flow runs, click Get From Cache > Execution 1 > View Input/Output to verify that the retrieved email matches the one that was added previously to the Cache.
Adding Multiple Items to Cache
The following example demonstrates how to add multiple items to a Cache compiling Admin Emails, via a Flow.
- In a Project, click CREATE FLOW. Select Flow, name the Flow, and click CREATE.
- From the Toolbox panel, attach a Create Data step from the FAVORITE STEPS category to the Start step.
- From the Properties tab of the Create Data step select SHOW EDITOR.
- From the Data to Create window, provide a NAME and select the String [Text] TYPE from the dropdown menu. Check the IS LIST box.
- Set INPUT to Constant, then map the desired Emails. Click DONE then Save and close the window.
- From FAVORITE STEPS, attach a Run Sub Flow step to the Create Data step. On the Properties panel, select PICK OR CREATE FLOW and create a new Flow.
- From the Flow Designer of the new Sub Flow, select SETUP INPUT DATA and then DEFINE under Define Input Data.
- From the Input Data window, enter "ListofItems" under NAME and select String [Text] as the TYPE. Check IS LIST, click save, and close the window.
- In the Toolbox panel, navigate to FLOW MANAGEMENT > ITERATION, attach a ForEach Step step to the Done path of the Start step. On the Properties panel next to Collection field, Select From Flow and map it to ListofItems.
- Under the SYSTEM > CACHING category, attach a [List] Add Item step to the Next path of the ForEach Step. On the Properties panel under CACHE SETUP, provide a Cache Name.
- Under INPUTS, Constant map the desired Key value. Then, Select From Flow map Item to Value. Utilizing the same Key should allow the ability to recover all the added Values at once.
- Connect the Done path of the [List] Add Item step to the ForEach Step, then connect the ForEach Step's Done path to the End step. The ForEach Step is used to split the input List of Emails into individual items, then send each item to the [List] Add Item step to be added to the Cache.
- Save the changes to the Sub Flow and close the Sub Flow.
- From the Parent Flow, select the Sub Flow step to navigate to its Properties tab and map the Output of the Create Data step, to the Email List Input of the Sub Flow.
- Connect the Done path of the Sub Flow to the End step. Then, save the Flow.
Click Debug from the top action bar. Select the Sub Flow, click Execution 1, and click View Input/Output Data.
Additional Cache Steps
Cache Step | Description |
---|---|
[List] Add Item | Adds a specified list of items to the cache. |
[List] Clear From Cache | |
[List] Get From Cache | |
Clear Cache By Name | Clear desired Instance in Cache. Can be selected by Name or Type. |
Clear Flow Step Cache | This clears the step cache for individual steps in a Flow. This does not clear any Cache instances. |
Clear Flow Step Cache [All Flows] | Clears the cache of all the steps within all Flows. This does not clear any Cache instances. |
Clear ORMEntityCache By Type | The Clear Cache By Type step is used to clear out Data entries from Caches in a Project based on the selected Type of Data -String, Int, etc. |
Delete From Cache By Filter | Delete certain items from a Cache by using a filter to set the properties of what is to be deleted. |
Filter Cache | Applies a filter to the cache. |
Get From Cache | Pulls a cache value based on a specific Key. |
Key Exists In Cache | Check if the Instance of the Cache contains the Key. |
Key Matches Substring In Cache | This Step will search the cache for keys that have any characters in its Key input. Then it will return True or False depending on the result. |
Put In Cache using Generated Key | Allows a user to put a value in the cache to generate and out a key to access the value. |
Put Items In Cache | Adds a String list of items to the selected cache. This looks for an existing list, whereas [List] Add Item actually creates a list of items. |
Remove Key From Cache | Removes the key value from a cache instance. |
Reset Constants and Lookups | The Reset Constants and Lookups step is used in conjunction with a Data Cache step to reset any existing constants or lookup list values in a cache. |
Feature Changes
Description | Version | Release Date | Developer Task |
---|---|---|---|
Cache steps have been upgraded to be Project specific. New steps were added. | 9.6 | January 2025 | [DT-043288] |