> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omni.co/llms.txt
> Use this file to discover all available pages before exploring further.

# cache_policies

> Defines cache policies for the model.

Defines cache policies for the model. Each policy must have a `max_cache_age` parameter that defines the time limit for the policy.

Omni defaults to the following cache policy and filter suggestion retention period:

* **Default cache policy** - 6 hours; overridden with [`max_cache_age`](#param-max-cache-age)
* **Filter suggestion retention** - 30 days; overridden when [`filter_suggestions_must_obey_policy`](#param-filter-suggestions-must-obey-policy) is `true`
* **Omni Agent chat summary responses** - 30 days

**Note**: This parameter allows you to set defaults for the model, but caching policies can also be set at the dashboard level. Editing cache policies in a workbook model or query model effectively applies the policy to the associated dashboard.

Refer to the [Topics documentation](/modeling/topics) for information about setting topic-level cache policies.

## Syntax

```yaml theme={null}
cache_policies:
  <cache_policy_name>:
     max_cache_age: <0_seconds_to_30_days>
     filter_suggestions_must_obey_policy: true/false
```

<ParamField path="cache_policy_name" type="string" required>
  A name that uniquely identifies the cache policy.

  <Expandable title="cache_policy_name properties" defaultOpen="true">
    <ParamField body="max_cache_age" type="string" required>
      Defines the time limit for the cache policy.

      Accepted values must be between `0 seconds` and `30 days`. If a value exceeding `30 days` is entered Omni will default to the model's specified `default_cache_policy`. If a default policy isn't set, Omni's default policy of 6 hours will be used.
    </ParamField>

    <ParamField body="filter_suggestions_must_obey_policy" type="boolean" default="false">
      <Warning>
        This setting can't currently be removed if set, but it can be changed if needed.
      </Warning>

      Determines whether filter suggestions obey the cache policy. If `false`, filter suggestions will be retained for 30 days. Defaults to `false`.
    </ParamField>

    <ParamField body="default_cache_policy" type="string">
      Defines the default cache policy for the model.

      If set, the cache policy will be applied to all topics in the model and override Omni's default cache policy. Refer to the [Topics documentation](/modeling/topics) for information about setting topic-level cache policies.
    </ParamField>
  </Expandable>
</ParamField>

## Examples

```yaml title="Retain filter suggestions for 30 days" theme={null}
cache_policies:
  dont_cache_at_all:
    max_cache_age: 0 seconds
    filter_suggestions_must_obey_policy: false       # Retain filter suggestions for 30 days
```

```yaml title="Obey cache policy & retain for 24 hours" theme={null}
cache_policies:
  cache_for_a_day:
    max_cache_age: 24 hours
    filter_suggestions_must_obey_policy: true        # Obey cache policy & retain for 24 hours
```
