# cache

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [connect-full.txt](https://docs.redpanda.com/connect-full.txt)

---
title: cache
latest-connect-version: 4.93.0
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-redpanda-tag: v26.1.9
docname: outputs/cache
page-component-name: connect
page-version: master
page-component-version: master
page-component-title: Connect
page-relative-src-path: outputs/cache.adoc
page-edit-url: https://github.com/redpanda-data/rp-connect-docs/edit/main/modules/components/pages/outputs/cache.adoc
page-git-created-date: "2024-05-24"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/connect/components/outputs/cache.md -->

**Type:** Output ▼

[Output](https://docs.redpanda.com/connect/components/outputs/cache/)[Processor](https://docs.redpanda.com/connect/components/processors/cache/)

**Available in:** [Cloud](https://docs.redpanda.com/cloud-data-platform/develop/connect/components/outputs/cache/%20%22View%20the%20Cloud%20version%20of%20this%20component%22), Self-Managed

Stores each message in a [cache](https://docs.redpanda.com/connect/components/caches/about/).

#### Common

```yml
outputs:
  label: ""
  cache:
    target: "" # No default (required)
    key: ${!count("items")}-${!timestamp_unix_nano()}
    max_in_flight: 64
```

#### Advanced

```yml
outputs:
  label: ""
  cache:
    target: "" # No default (required)
    key: ${!count("items")}-${!timestamp_unix_nano()}
    ttl: "" # No default (optional)
    max_in_flight: 64
```

Caches are configured as [resources](https://docs.redpanda.com/connect/components/caches/about/), where there’s a wide variety to choose from.

The `target` field must reference a configured cache resource label like follows:

```yaml
output:
  cache:
    target: foo
    key: ${!json("document.id")}

cache_resources:
  - label: foo
    memcached:
      addresses:
        - localhost:11211
      default_ttl: 60s
```

In order to create a unique `key` value per item you should use function interpolations described in [Bloblang queries](https://docs.redpanda.com/connect/configuration/interpolation/#bloblang-queries).

## [](#performance)Performance

This output benefits from sending multiple messages in flight in parallel for improved performance. You can tune the max number of in flight messages (or message batches) with the field `max_in_flight`.

## [](#fields)Fields

### [](#key)`key`

The key to store messages by, function interpolation should be used in order to derive a unique key for each message. This field supports [interpolation functions](https://docs.redpanda.com/connect/configuration/interpolation/#bloblang-queries).

**Type**: `string`

**Default**: `${!count("items")}-${!timestamp_unix_nano()}`

```yaml
# Examples:
key: ${!count("items")}-${!timestamp_unix_nano()}

# ---

key: ${!json("doc.id")}

# ---

key: ${!meta("kafka_key")}
```

### [](#max_in_flight)`max_in_flight`

The maximum number of messages to have in flight at a given time. Increase this to improve throughput.

**Type**: `int`

**Default**: `64`

### [](#target)`target`

The target cache to store messages in.

**Type**: `string`

### [](#ttl)`ttl`

The TTL of each individual item as a duration string. After this period an item will be eligible for removal during the next compaction. Not all caches support per-key TTLs, and those that do not will fall back to their generally configured TTL setting. This field supports [interpolation functions](https://docs.redpanda.com/connect/configuration/interpolation/#bloblang-queries).

Requires version 3.33.0 or later.

**Type**: `string`

```yaml
# Examples:
ttl: 60s

# ---

ttl: 5m

# ---

ttl: 36h
```