# Loading all cached data from a static cache key

## Introduction

This approach is the simplest - all incoming data is cached with a static cache key.&#x20;

## How it works

In the example below, all incoming customer records will be added to a cache named `ALLcustomers` and a static **cache key** named `customers`:&#x20;

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

When the data is cached, it's likely that the cache will include multiple records - for example:

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

To retrieve this cache, we simply drop a **load from cache** shape where required in the process flow and specify the same **cache** and **cache key** that were defined in the corresponding **add to cache** shape:

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

## Load a single, targeted item from a dynamic cache key

This approach assumes  The [load from cache](/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/load-from-cache-shape.md) shape works as normal to retrieve cached data where the cache was created with a payload variable - you choose the cache name and key to be loaded:

<div align="left"><figure><img src="/files/d1PHhkwbW215YpeT9RFS" alt="" width="351"><figcaption></figcaption></figure></div>

However, the important point to consider is that the **cache key** that you specify here will have been generated from the payload variable that was specified when the cache was created.&#x20;

If a payload variable has been used to cache data, you would typically have included a [flow control shape](/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/flow-control-shape.md) to create multiple payloads - for example:

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

So you will have multiple cache keys that can be loaded. To do this, you can add one [load from cache](/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/load-from-cache-shape.md) shape for every `cache key` that you want to retrieve, specifying the required key in each case. For example:

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

Alternatively, you can add a single [load from cache](/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/load-from-cache-shape.md) shape and target specific cache keys by passing in the required ids.&#x20;

## Load multiple, targeted items from a dynamic cache key


---

# 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/load-from-cache-shape/what-cached-data-do-you-want-to-load/loading-all-cached-data-from-a-static-cache-key.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.
