> ## Documentation Index
> Fetch the complete documentation index at: https://university.triggr-app.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cache

> Keep a workflow's result ready, refreshed hourly, daily, weekly or monthly, so form dropdowns load instantly and workflows can reuse it.

Data > Cache keeps a workflow's result and refreshes it on a schedule, so a form dropdown that needs a slow lookup, such as your PSA's ticket categories, loads instantly. Workflows can read it too. You need the [Admin role](/studio/clients/team-and-permissions#roles).

<Frame caption="Cache a result: publishing a workflow's list, caching it daily, filling it now and using it in a form dropdown (1:28).">
  <video controls preload="none" playsInline className="w-full aspect-video rounded-xl" poster="/images/videos/studio-cache.jpg" src="https://mintcdn.com/triggr/GxrCQFDFNLmEMyJ1/images/videos/studio-cache.mp4?fit=max&auto=format&n=GxrCQFDFNLmEMyJ1&q=85&s=2820bf9aff868b44f3b9b0561b0da105" data-path="images/videos/studio-cache.mp4" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/data/cache-definitions.png?fit=max&auto=format&n=_d7ojda9vf8IHE31&q=85&s=e62f5ed12af10c5addb171aad6679ad1" alt="The Cache Definitions page, Cache data to improve form loading times, with Refresh and New Cache Definition buttons and one definition, Docs sample – Ticket categories: Global scope, workflow Docs sample – Ticket categories, Daily, Enabled, with View and delete actions." width="2768" height="788" data-path="images/studio/data/cache-definitions.png" />
</Frame>

## Example: ticket categories for a form

<Steps>
  <Step title="Publish the list from a workflow">
    Build a workflow whose last data step produces the list, such as `{ "id": …, "name": … }` items from your PSA, ending at a Finish Workflow step. On that step's Settings tab, enter a variable name, tick **Publish Variable** and save (see [Save an output under a short name](/studio/workflows/expressions#save-an-output-under-a-short-name)).

    <Frame>
      <img src="https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/data/publish-variable.png?fit=max&auto=format&n=_d7ojda9vf8IHE31&q=85&s=f46b0e09105b011da51f8a66e4cc031c" width="384" alt="The List Categories step's Settings tab: Set Output As Context Variable, Context Variable Name categories, and Publish Variable ticked." data-path="images/studio/data/publish-variable.png" />
    </Frame>
  </Step>

  <Step title="Create the cache definition">
    Click **New Cache Definition**, name it, set Scope to Global, choose the workflow, enter the variable's name as the Published Variable Name, pick a Frequency and click Create Cache Definition.

    <Frame>
      <img src="https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/data/new-cache-definition.png?fit=max&auto=format&n=_d7ojda9vf8IHE31&q=85&s=dce5558d059143724d1e896380dc3eca" width="672" alt="The Create New Cache Definition dialog: Name Docs sample – Ticket categories, Scope Global, Workflow Docs sample – Ticket categories, Workflow Params (JSON) an empty JSON object, Published Variable Name categories and Frequency Daily, with Cancel and Create Cache Definition buttons." data-path="images/studio/data/new-cache-definition.png" />
    </Frame>

    Scope starts on Per Tenant, which keeps one value per client ([Per-client caches](#per-client-caches)); Global keeps one for everyone. Leave Workflow Params as `{}`.
  </Step>

  <Step title="Fill it now">
    Open the definition, click **Run on Demand** and confirm; otherwise it first fills at its next scheduled time.

    <Frame>
      <img src="https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/data/run-on-demand.png?fit=max&auto=format&n=_d7ojda9vf8IHE31&q=85&s=8027c59d6b042d4abf8eaecc25c47357" width="672" alt="The Run Cache on Demand dialog explaining it will execute the cache workflow immediately, with Cancel and Cache Data buttons." data-path="images/studio/data/run-on-demand.png" />
    </Frame>
  </Step>

  <Step title="Check the value">
    Refresh the page: Current Cache Value shows when it was filled, and Execution Logs lists each run.

    <Frame>
      <img src="https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/data/cache-definition.png?fit=max&auto=format&n=_d7ojda9vf8IHE31&q=85&s=5503220ffe17a1779972df8c7b9e3608" alt="The Docs sample – Ticket categories cache page with Run on Demand, Invalidate Cache, Edit and Refresh buttons; Cache Definition Details showing Global, Enabled, Published Variable categories, Daily and Next Execution; Current Cache Value with one array entry and View Cache Data; and Execution Logs with one SUCCESS run of 1.13s." width="2368" height="2326" data-path="images/studio/data/cache-definition.png" />
    </Frame>

    View Cache Data shows what's stored:

    <Frame>
      <img src="https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/data/cache-entry.png?fit=max&auto=format&n=_d7ojda9vf8IHE31&q=85&s=3a2fad464b645535be694ccb0c877bec" width="672" alt="The Cache Entry Details dialog: Object Type array and a Value listing hardware, software, access and new-starter, each with an id and a name such as Access and passwords." data-path="images/studio/data/cache-entry.png" />
    </Frame>
  </Step>

  <Step title="Use it in a form">
    In the form designer, click a Select field, set **Options Source** to Use cache and choose the cache definition. Value Key and Label Key start as `id` and `name`; change them if your items use other fields.

    <Frame>
      <img src="https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/data/form-cache-options.png?fit=max&auto=format&n=_d7ojda9vf8IHE31&q=85&s=a2e23c7f4439ae386afda7910e5f9d1c" width="318" alt="A Select field's properties with Options Source Use cache, Cache Definition Docs sample – Ticket categories, Value Key id and Label Key name." data-path="images/studio/data/form-cache-options.png" />
    </Frame>

    The dropdown now lists the cached items:

    <Frame>
      <img src="https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/data/form-cache-preview.png?fit=max&auto=format&n=_d7ojda9vf8IHE31&q=85&s=3b19ab14ef39f0f815ec999359cf4363" width="600" alt="A form preview with a Category dropdown open, listing Hardware, Software, Access and passwords, and New starter." data-path="images/studio/data/form-cache-preview.png" />
    </Frame>
  </Step>
</Steps>

## Read it in a workflow

Add **Get Cache Data** from Cache, choose the cache definition and leave Tenant ID empty for a global cache. The stored value is in `value`: `{{ ctx.steps['Get Categories'].value }}`.

<Frame>
  <img src="https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/data/get-cache-data-step.png?fit=max&auto=format&n=_d7ojda9vf8IHE31&q=85&s=b08bdbdb6510599a929dc7c9b93744a6" width="384" alt="The Get Categories step: Cache Definition Docs sample – Ticket categories and an empty Tenant ID, described as optional and left empty for global caches." data-path="images/studio/data/get-cache-data-step.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/data/get-cache-data-output.png?fit=max&auto=format&n=_d7ojda9vf8IHE31&q=85&s=17b8d9f7d1dbec1b952cc542c5fb38c8" width="600" alt="The Get Categories step in a run: Status success, Type get_cache_data, and Output with value listing the four categories, success true, executedAt, cacheDefinition, valueTypeSummary array and workflowExecutionID." data-path="images/studio/data/get-cache-data-output.png" />
</Frame>

| Step | What it does |
| - | - |
| Get Cache Data | Returns the stored value, or runs the workflow and waits if there isn't one yet |
| Refresh Cache Data | Runs the workflow now, waits and stores the new value |
| Invalidate Cache Data | Deletes the stored value; the next read or scheduled run fills it again |

When a workflow adds a ticket category in your PSA, for example, end it with Refresh Cache Data so the form shows it straight away.

## How it refreshes

* The frequency counts from when you created the definition: a Daily cache created at 09:10 UTC refreshes at about 09:10 UTC each day.
* A stored value stays until a run replaces it; if a run fails, forms and workflows keep the last good value and Execution Logs shows why.
* Each run has 5 minutes, and a value can be up to 10 MB.
* Invalidate Cache deletes the stored values; Edit changes the definition or disables it, and changing its workflow, published variable or scope also clears the values.

## Per-client caches

With Scope set to Per Tenant, Triggr stores a value per client, or for the clients you pick. Each run gets the client's ID in `ctx.metadata.tenantId`, so start the workflow with a Set Client From Form step to load that client's variables and integrations. A form reads the signed-in person's client's value; in Get Cache Data, set Tenant ID to `{{ ctx.client.id }}`.

## Troubleshooting

<AccordionGroup>
  <Accordion title="“published variable '…' not found in workflow result” or “no published variables found in workflow result”">
    Check the step's Settings tab has Publish Variable ticked, the name matches the definition, and the run reaches Finish Workflow.
  </Accordion>

  <Accordion title="“workflow execution timed out after 5 minutes”">
    Fetch less, or split the workflow into several caches.
  </Accordion>

  <Accordion title="The form's dropdown is empty">
    The cached value must be a list of items that each have the Value Key and Label Key fields; check its shape with View Cache Data.
  </Accordion>

  <Accordion title="“tenantID is required for per-tenant cache definitions”">
    The Get Cache Data step for a Per Tenant cache needs Tenant ID set to `{{ ctx.client.id }}`.
  </Accordion>

  <Accordion title="“cache definition is disabled”">
    On the definition's page, click **Edit**, set it to Enabled and save.
  </Accordion>

  <Accordion title="Can an internal app or an AI assistant read a cache?">
    An internal app can't. An AI assistant connected through [MCP](/studio/mcp) can, with Cache tools such as `get_cache_entries` and `run_cache`.
  </Accordion>
</AccordionGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.