# Cache maintenance

## Introduction

You can [view](#cache-details), [create](#creating-a-cache), and [manage](#cache-details) all existing caches from the `data caches` page. To access this page, select `process flows` ➤ `caches` from the dashboard navigation menu:

<div align="left"><figure><img src="/files/95AULjvUIvEwJsIG6xyY" alt="" width="229"><figcaption></figcaption></figure></div>

## Need to know

{% hint style="danger" %}
During routine platform maintenance, cached data may be cleared. While we make a best effort to retain data for up to 7 days, it could be cleared sooner. Please design your process flows accordingly.
{% endhint %}

## The data caches page

The `data caches` page is split into three sections: `flow run caches`, `flow caches`, and `company caches`:

<div align="left"><figure><img src="/files/3f7PAM3UMHjyRbgdE96J" alt=""><figcaption></figcaption></figure></div>

Each cache is listed with the following details:

| Item                                                            | Summary                                                                                                                                                                                                                                |
| --------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Name                                                            | The name that was specified when the cache was created. Caches are created via the [add to cache shape](/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/add-to-cache-shape.md).  |
| Flow                                                            | For `flow` and `flow run` caches, this is the name of the process flow which is using the cache. This information is not shown for `company` caches, as the cache might be used in any process flow within a company profile.          |
| Created                                                         | The date and time that the cache was created.                                                                                                                                                                                          |
| Last accessed                                                   | The date and time that the cache was last accessed by a process flow. The cache may or may not have been updated with data at this time (even if there is no data to be added, the access date/time is logged).                        |
| Keys                                                            | The number of cache keys associated with this cache. Cache keys are created via the [add to cache shape](/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/add-to-cache-shape.md). |
| Size                                                            | The current size of the cache in proportion to the limit.                                                                                                                                                                              |
| <img src="/files/idlY0uVbs2hpzpsxUCJQ" alt="" data-size="line"> | Delete the cache (and all associated data).                                                                                                                                                                                            |

If you have a lot of caches, you can search by name:

<figure><img src="/files/etRyTUx7k7z1Hmzr6DSX" alt=""><figcaption></figcaption></figure>

To access [cache details](#cache-details) for a particular cache, click on its name:

<figure><img src="/files/dFfa5s1AAomj7O64VIKU" alt=""><figcaption></figcaption></figure>

## Cache details

When you select a cache from the list, an edit cache page is displayed:

<div align="left"><figure><img src="/files/oyhDilBfO06l28GLcknK" alt=""><figcaption></figcaption></figure></div>

From here you can:

* [View and change the cache name](#viewing-and-changing-the-cache-name)
* [View and change the maximum age (retention period)](#viewing-and-changing-the-maximum-age-retention-period)
* [View usage information](#viewing-usage-information)
* [View cache contents](#viewing-cache-contents)
* [Clear the cache](#clearing-the-cache)

### Viewing & changing the cache name

To change the name of the cache, simply update the `name` field in the upper `cache detail`**s** panel, then click the `save` button.

When the name is updated and saved, the change is immediately reflected in any [add to cache](/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/add-to-cache-shape.md) shapes in process flows, where this cache is used.

{% hint style="danger" %}
The cache name must not include full stop (**.**) or colon (**:**) characters.
{% endhint %}

### Viewing & changing the maximum age (retention period)

You can use the `maximum age` slider to change the cache retention period for a cache:

<figure><img src="/files/c8MfW0RsyicXbx9Azcrj" alt=""><figcaption></figcaption></figure>

Note that:

* The maximum age for a `flow run` cache is 2 hours - this cannot be changed
* The maximum age for a `flow` or `company` cache can be changed to anything up to 7 days

### Viewing usage information

The usage panel shows general usage information about the cache:

<figure><img src="/files/36NAjzlZtcLfqWIWKFei" alt=""><figcaption></figcaption></figure>

Here you can see:

| Item          | Summary                                                                                                                 |
| ------------- | ----------------------------------------------------------------------------------------------------------------------- |
| Size          | The current size of the cache, shown with a percentage use indicator. The maximum cache size is 50MB                    |
| Created       | The date and time that the cache was created.                                                                           |
| Last accessed | The date and time that the cache was last accessed. This timestamp is updated even when no data was added to the cache. |
| Keys          | The number of keys associated with this cache.                                                                          |

### Viewing cache contents

The `cache contents` panel displays an entry for each cache key update. Information shown varies, depending on the cache type.

#### Flow run cache

<figure><img src="/files/3fMr2zTXu9tXleWW2IpL" alt=""><figcaption></figcaption></figure>

The following details are displayed for each cache item in a `flow run` type cache:

| Item                                                            | Summary                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Flow Run ID                                                     | The unique id of the process flow run that updated the cache key.                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Started at                                                      | The date and time that the process flow run was started.                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Key                                                             | The cache key name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Page                                                            | If multiple pages are added to a cache (for example, if incoming data is paginated or batched via [flow control shape](/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/flow-control-shape.md)) and the [add to cache](/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/add-to-cache-shape/cache-pagination-options.md#save-all-pages) **save all pages** option is togged ON), each page is listed individually. |
| Unique key                                                      | The internal cache key.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| <img src="/files/lUSfAxg6BrUPQpiLRNxJ" alt="" data-size="line"> | <p>Click the 'eye' icon to view the content associated with this key. For example:<br><img src="/files/xhu9Gr8Wg6h5VIrAZVeG" alt=""></p>                                                                                                                                                                                                                                                                                                                                                                              |
| Size                                                            | The size of the cache key.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

#### Flow cache / company cache

<figure><img src="/files/BBD4HthOaVYSxHysdqbT" alt=""><figcaption></figcaption></figure>

The following details are displayed for each cache item:

| Item                                                            | Summary                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Key                                                             | The cache key name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Page                                                            | If multiple pages are added to a cache (for example, if incoming data is paginated or batched via [flow control shape](/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/flow-control-shape.md)) and the [add to cache](/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/add-to-cache-shape/cache-pagination-options.md#save-all-pages) save all pages option is , each page is listed individually. |
| Unique key                                                      | The internal cache key.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| <img src="/files/lUSfAxg6BrUPQpiLRNxJ" alt="" data-size="line"> | <p>Click the 'eye' icon to view the content associated with this key. For example:<br><img src="/files/xhu9Gr8Wg6h5VIrAZVeG" alt=""></p>                                                                                                                                                                                                                                                                                                                                                                |
| Size                                                            | The size of the cache key.                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

### Clearing the cache

To clear all current content in the cache, click the `clear cacche` button:

<figure><img src="/files/tVHm5Gxny1Nts0YO3Kji" alt=""><figcaption></figcaption></figure>

This removes any existing data but leaves the cache in place so it can still be [used in process flows](/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/add-to-cache-shape.md).

## Creating a cache

Cache creation is an integral part of [configuring an add to cache shape](/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/add-to-cache-shape.md#adding-and-configuring-an-add-to-cache-shape-to-a-process-flow) within your process flow - for example:

<div align="left"><figure><img src="/files/iYiVNqO143m38obnN8Xy" alt="" width="375"><figcaption></figcaption></figure></div>

However, it can sometimes be useful to create caches via the `data caches` page. To do this, follow the steps below.

{% stepper %}
{% step %}
**Choose to create a new cache**&#x20;

Click the `create cache` button associated with the type of cache you want to create - `flow`, `flow run`, or `company`. For example:

<figure><img src="/files/IJ6AORB9XeIZRgwjzixJ" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
For information about the different types of cache that you can create, please see our [Add to cache shape](/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/add-to-cache-shape.md) page.
{% endhint %}
{% endstep %}

{% step %}
**Enter cache details**&#x20;

If you choose to create a `flow` or `flow run` cache, the following details are required:

<div align="left"><figure><img src="/files/AtlJiMp56XOQPzLJD49J" alt="" width="563"><figcaption></figcaption></figure></div>

Required fields are summarised below:

<table><thead><tr><th width="223.91796875">Field</th><th>Summary</th></tr></thead><tbody><tr><td>Name</td><td>Enter a name for the cache (this name is displayed wherever the cache is used in the dashboard).</td></tr><tr><td>Flows</td><td><p>Select a process flow to be associated with this cache. </p><p></p><p>All process flows are available for selection, irrespective of whether they include an <a href="/pages/aGi157tdOz4wMkNdBOWh">add to cache</a> shape. Selecting a flow here does NOT add/configure <code>add to cache</code> shapes in selected process flows, it simply makes an association. </p><p></p><p>When you go on to add or update an <code>add to cache</code> shape in the associated process flow, this cache will be available for selection (it won't be available in any other process flows). </p></td></tr><tr><td>Data retention</td><td>Select the required duration that cached data should be kept. For more information on this setting, please see our <a href="/pages/aGi157tdOz4wMkNdBOWh">Add to cache shape</a> page.</td></tr></tbody></table>

If you choose to create a `company` cache, the following details are required:

<div align="left"><figure><img src="/files/lPDpnhDOVY5MZyqxIUHW" alt="" width="563"><figcaption></figcaption></figure></div>

This is the same information detailed for `flow` and `flow run` caches above, except there's no requirement to select an associated flow. `company` caches are available for selection in any process flow.&#x20;
{% endstep %}

{% step %}
**Confirm settings**

Click the `save` button to save settings and create the cache.
{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/cache-maintenance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
