Cache and KV adapters for Payload CMS 4

Move the Payload CMS key-value store out of the main database. Adapters for Redis, Upstash and Cloudflare Workers KV plug into the kv option.

Stores Payload key-value data in Redis through the payload.kv API

Stores Payload key-value data in Upstash Redis with key prefixes and expiry rules

About these packages

A KV adapter gives Payload a dedicated key-value store. You configure it in the kv option of payload.config. Without one, Payload keeps those values in its main database.

What these adapters cover

  • The official Redis KV adapter for data shared across instances
  • Upstash Redis with key prefixes and expiry rules
  • Cloudflare KV adapters that keep values in a Workers KV namespace

Choosing a KV adapter

Use the official Redis adapter when Redis already runs next to your app. It also fits when several instances need the same data. Upstash suits serverless deployments that cannot keep a persistent connection open. On Cloudflare Workers, pick a Cloudflare KV package by Payload version. One targets the Payload 4 beta, and the other targets Payload 3. Response caching and Next.js revalidation are a different job, covered by the cache plugins.

Frequently asked questions

What does a KV adapter do in Payload CMS?

It replaces the default database-backed key-value store with a dedicated one. You set it once in the kv option, and Payload reads and writes those values through it.

Do I need Redis to run Payload?

No. Payload works without a KV adapter. Add one when you want those values out of your main database or shared across several instances.

Which KV adapter works on serverless platforms?

Upstash and Cloudflare KV reach their stores over HTTP or a platform binding. They need no long-lived connection, which suits serverless and edge runtimes.