Skip to content
REFERENCE

U.CACHE

Summary

Persists specified data in memory within the add-in for efficient reuse either repeatedly or only once

Syntax

=U.CACHE(data, [cache_key], [page_filter], [expiry_seconds], [block])

Parameters

Parameter Required Description
data Yes The data to be cached. Could refer to a cell containing U.SUBSCRIBE, and the report's content will be cached. If not provided and a cache key is specified, any cached data for that key will be removed
[cache_key] No The name used to retrieve the data from the cache. If not provided, a unique ID is assigned and returned, in which case the cache will be a "read-once" cache and the data will be removed from the cache once the unique key is used. Set as "set_name()" to have an Excel name equal to the cache key applied to the calling cell
[page_filter] No If the desire is to cache only one or a few pages from a multi-page U report, specify the pages to be cached with a filter. For example a filter of "1,3-5,8" would cache pages 1,3,4,5 and 8 of the specified report
[expiry_seconds] No If provided the data will automatically be removed from the cache after specified number of seconds. Default is 10 minutes for a read-once cache. If a cache key is provided, then by default the cache is never cleared automatically
[block] No If set to TRUE then method will not be calculated unless triggered by user interaction or calculated as a step in a script. Throttling also supported. If a cache_key is provided and the cache exists, that key will be returned when the method is blocked. Provide a 2nd column here set to TRUE to return block message instead

Behavior

The documented public interface is supported by the current U Add-in source signature and the maintained Usage Examples workbook. Optional parameters are shown in square brackets in the syntax above; omit the brackets when entering a formula.

Return Value

With a named cache key, returns that key with a cache timestamp. Without a key, returns a unique read-once key whose data is removed after it is consumed.

Examples

=U.CACHE((B47:C49,B52:C54),"Data 1")
=U.CACHE((B57:C59,B62:C64),"Data 2")
=U.DO(U.CACHE(B76:C78,"Range1"),U.NOW())

Notes

  • Formula examples are preserved from maintained workbook usage and normalized to the current U. prefix.
  • Complete formulas demonstrate working patterns; they do not imply that undocumented option values are supported.
  • Where maintained sources do not specify every accepted value, default, or error message, this page does not infer one.
  • For functions that perform actions, use a visible trigger or supported block/throttle parameter to avoid unintended repetition during recalculation.