- 25 Jun 2024
- 1 Minute to read
- Print
- DarkLight
Caching Data Structures
- Updated on 25 Jun 2024
- 1 Minute to read
- Print
- DarkLight
Overview
Caching allows users the option to cache data for a specified Data Structure. This allows users to keep an additional copy of the data that can be quickly fetched from the Data Cache rather than utilizing additional system resources required to pull information directly from an object's database table.
Example
The following example will demonstrate how to enable caching on a data structure and add data to the data structure.
- From a Designer Project, click CREATE DATAYPES/INTEGRATION and click Database Structure.
- On the Database Structure window, enter "UserInfo" as the Structure Type Name. Under Name, enter "Email" and select String [Text] as the Type. Under the ADVANCED category click the Enable Caching checkbox. Click SAVE.
- From a Designer Project, click CREATE FLOW and select Flow. Name the Flow and click CREATE.
- In the Toolbox panel, navigate to USER DEFINED TYPES > DATABASE STRUCTURES > USERINFO and attach a Create UserInfo step to the Start and End steps.
- From the Properties panel of the Create step under INPUTS > Item to Create, map a Constant value (fakeemail@fakeemail.com).
- Click Save to save changes to the Flow, then click Debug on the top action bar.
- After the Flow runs, select Create UserInfo > Execution 1 > View Input/Output Data and verify that the Flow has created the data value as expected.Since the Enable Caching option was used on the Data Structure, the resulting saved value will be saved to the Database Table of the Data Structure and into a Cache.
About Entities Steps
Once Enable Caching is established on a Data Structure, any data retrieved via a Fetch Entities step will be retrieved from the Data Cache rather than the database table itself. This helps to reduce time and system load when fetching the data. Additionally, utilizing the other Entity steps (from Toolbox > DATABASE), such as Save Entities or Update Entity/Entities for a Data Structure with caching enabled, will save the changes to the cache first. It will then push the changes to the Database Table to keep both of them in sync with one another.
Alternate Caching Method
Data Structures can also be Cached by specifying a value directly into a Put In Cache step and retrieved via a Get From Cache step and a Key value.