Search
⌃K
Links

cached

To run a given script only once and cache and return the output value
This function allows you to cache calculations of an elaborate script during the first execution. Instead of a new calculation, the saved value is then returned.
But if you want to trigger a recalculation of your script, you have the following options:
  • Activate the edit mode
    ​
  • Execute the invalidate() function in any table of your database
This feature can help solve performance problems.
Learn more about Optimizing scripts​

Syntax

cached(script)

Return

any

Examples

1
let cache := cached(
2
let user := user();
3
select Tasks where 'Due Date' > today() and 'Assigned user'.'Ninox user' = user
4
);
5
cache
Result: The records from the Tasks table that are still open and assigned to the current user are cached and returned.

See also

​invalidate, which clears the cache of the database and the values stored by cached().