[WIP] Cached Functions (fields): understanding and managing

What Are Cached Functions (fields)?

Cached functions (fields) are a performance optimization feature that stores calculated values in the database instead of computing them each time they are needed. This is particularly useful for complex calculations that otherwise would slow down your application.

Why Use Cached Functions?

When working with complex calculations, especially in data grids or frequently accessed areas, regular functions can significantly impact performance. Cached functions solve this by:

  • Storing pre-calculated values in the database,
  • Automatically updating stored values when dependencies change,
  • Eliminating the need for repeated calculations.

Important Considerations

Dependencies Between Cached Functions

When working with nested cached functions (a cached function that uses another cached function), you must be careful with the update order:

  1. Always update the inner cached function first,
  2. Then update the dependent cached function,
  3. Failing to follow this order can result in incorrect values.

How to add cached functions in the architect

In the Architect open the component > find/create a function (1) you want to cache > click on it > in “Properties” tab > “Settings” > “Enable cache” (2):

This button toggles the option “Enable cache” on/off, so be carefull with doubleclicking.

How to manage application updates with new/modified cached fields

[WIP]
Cached field values are checked during an update and set/adjusted automatically. If the cached fields check failed (for example, because they are based on other values that are incorrect), you
see errors in the system health check.

In more complex cases you can use an update script. Check the example here:

1 Like